@@ -1067,13 +1067,75 @@ exports._readLinuxVersionFile = _readLinuxVersionFile;
10671067
10681068/***/ } ) ,
10691069
1070+ /***/ 82 :
1071+ /***/ ( function ( __unusedmodule , exports ) {
1072+
1073+ "use strict" ;
1074+
1075+ // We use any as a valid input type
1076+ /* eslint-disable @typescript-eslint/no-explicit-any */
1077+ Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
1078+ /**
1079+ * Sanitizes an input into a string so it can be passed into issueCommand safely
1080+ * @param input input to sanitize into a string
1081+ */
1082+ function toCommandValue ( input ) {
1083+ if ( input === null || input === undefined ) {
1084+ return '' ;
1085+ }
1086+ else if ( typeof input === 'string' || input instanceof String ) {
1087+ return input ;
1088+ }
1089+ return JSON . stringify ( input ) ;
1090+ }
1091+ exports . toCommandValue = toCommandValue ;
1092+ //# sourceMappingURL=utils.js.map
1093+
1094+ /***/ } ) ,
1095+
10701096/***/ 87 :
10711097/***/ ( function ( module ) {
10721098
10731099module . exports = require ( "os" ) ;
10741100
10751101/***/ } ) ,
10761102
1103+ /***/ 102 :
1104+ /***/ ( function ( __unusedmodule , exports , __webpack_require__ ) {
1105+
1106+ "use strict" ;
1107+
1108+ // For internal use, subject to change.
1109+ var __importStar = ( this && this . __importStar ) || function ( mod ) {
1110+ if ( mod && mod . __esModule ) return mod ;
1111+ var result = { } ;
1112+ if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
1113+ result [ "default" ] = mod ;
1114+ return result ;
1115+ } ;
1116+ Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
1117+ // We use any as a valid input type
1118+ /* eslint-disable @typescript-eslint/no-explicit-any */
1119+ const fs = __importStar ( __webpack_require__ ( 747 ) ) ;
1120+ const os = __importStar ( __webpack_require__ ( 87 ) ) ;
1121+ const utils_1 = __webpack_require__ ( 82 ) ;
1122+ function issueCommand ( command , message ) {
1123+ const filePath = process . env [ `GITHUB_${ command } ` ] ;
1124+ if ( ! filePath ) {
1125+ throw new Error ( `Unable to find environment variable for file command ${ command } ` ) ;
1126+ }
1127+ if ( ! fs . existsSync ( filePath ) ) {
1128+ throw new Error ( `Missing file at path: ${ filePath } ` ) ;
1129+ }
1130+ fs . appendFileSync ( filePath , `${ utils_1 . toCommandValue ( message ) } ${ os . EOL } ` , {
1131+ encoding : 'utf8'
1132+ } ) ;
1133+ }
1134+ exports . issueCommand = issueCommand ;
1135+ //# sourceMappingURL=file-command.js.map
1136+
1137+ /***/ } ) ,
1138+
10771139/***/ 129 :
10781140/***/ ( function ( module ) {
10791141
@@ -3150,6 +3212,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
31503212} ;
31513213Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
31523214const os = __importStar ( __webpack_require__ ( 87 ) ) ;
3215+ const utils_1 = __webpack_require__ ( 82 ) ;
31533216/**
31543217 * Commands
31553218 *
@@ -3203,28 +3266,14 @@ class Command {
32033266 return cmdStr ;
32043267 }
32053268}
3206- /**
3207- * Sanitizes an input into a string so it can be passed into issueCommand safely
3208- * @param input input to sanitize into a string
3209- */
3210- function toCommandValue ( input ) {
3211- if ( input === null || input === undefined ) {
3212- return '' ;
3213- }
3214- else if ( typeof input === 'string' || input instanceof String ) {
3215- return input ;
3216- }
3217- return JSON . stringify ( input ) ;
3218- }
3219- exports . toCommandValue = toCommandValue ;
32203269function escapeData ( s ) {
3221- return toCommandValue ( s )
3270+ return utils_1 . toCommandValue ( s )
32223271 . replace ( / % / g, '%25' )
32233272 . replace ( / \r / g, '%0D' )
32243273 . replace ( / \n / g, '%0A' ) ;
32253274}
32263275function escapeProperty ( s ) {
3227- return toCommandValue ( s )
3276+ return utils_1 . toCommandValue ( s )
32283277 . replace ( / % / g, '%25' )
32293278 . replace ( / \r / g, '%0D' )
32303279 . replace ( / \n / g, '%0A' )
@@ -3258,6 +3307,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
32583307} ;
32593308Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
32603309const command_1 = __webpack_require__ ( 431 ) ;
3310+ const file_command_1 = __webpack_require__ ( 102 ) ;
3311+ const utils_1 = __webpack_require__ ( 82 ) ;
32613312const os = __importStar ( __webpack_require__ ( 87 ) ) ;
32623313const path = __importStar ( __webpack_require__ ( 622 ) ) ;
32633314/**
@@ -3284,9 +3335,17 @@ var ExitCode;
32843335 */
32853336// eslint-disable-next-line @typescript-eslint/no-explicit-any
32863337function exportVariable ( name , val ) {
3287- const convertedVal = command_1 . toCommandValue ( val ) ;
3338+ const convertedVal = utils_1 . toCommandValue ( val ) ;
32883339 process . env [ name ] = convertedVal ;
3289- command_1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
3340+ const filePath = process . env [ 'GITHUB_ENV' ] || '' ;
3341+ if ( filePath ) {
3342+ const delimiter = '_GitHubActionsFileCommandDelimeter_' ;
3343+ const commandValue = `${ name } <<${ delimiter } ${ os . EOL } ${ convertedVal } ${ os . EOL } ${ delimiter } ` ;
3344+ file_command_1 . issueCommand ( 'ENV' , commandValue ) ;
3345+ }
3346+ else {
3347+ command_1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
3348+ }
32903349}
32913350exports . exportVariable = exportVariable ;
32923351/**
@@ -3302,7 +3361,13 @@ exports.setSecret = setSecret;
33023361 * @param inputPath
33033362 */
33043363function addPath ( inputPath ) {
3305- command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
3364+ const filePath = process . env [ 'GITHUB_PATH' ] || '' ;
3365+ if ( filePath ) {
3366+ file_command_1 . issueCommand ( 'PATH' , inputPath ) ;
3367+ }
3368+ else {
3369+ command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
3370+ }
33063371 process . env [ 'PATH' ] = `${ inputPath } ${ path . delimiter } ${ process . env [ 'PATH' ] } ` ;
33073372}
33083373exports . addPath = addPath ;
0 commit comments