@@ -1073,13 +1073,75 @@ exports._readLinuxVersionFile = _readLinuxVersionFile;
10731073
10741074/***/ } ) ,
10751075
1076+ /***/ 82 :
1077+ /***/ ( function ( __unusedmodule , exports ) {
1078+
1079+ "use strict" ;
1080+
1081+ // We use any as a valid input type
1082+ /* eslint-disable @typescript-eslint/no-explicit-any */
1083+ Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
1084+ /**
1085+ * Sanitizes an input into a string so it can be passed into issueCommand safely
1086+ * @param input input to sanitize into a string
1087+ */
1088+ function toCommandValue ( input ) {
1089+ if ( input === null || input === undefined ) {
1090+ return '' ;
1091+ }
1092+ else if ( typeof input === 'string' || input instanceof String ) {
1093+ return input ;
1094+ }
1095+ return JSON . stringify ( input ) ;
1096+ }
1097+ exports . toCommandValue = toCommandValue ;
1098+ //# sourceMappingURL=utils.js.map
1099+
1100+ /***/ } ) ,
1101+
10761102/***/ 87 :
10771103/***/ ( function ( module ) {
10781104
10791105module . exports = require ( "os" ) ;
10801106
10811107/***/ } ) ,
10821108
1109+ /***/ 102 :
1110+ /***/ ( function ( __unusedmodule , exports , __webpack_require__ ) {
1111+
1112+ "use strict" ;
1113+
1114+ // For internal use, subject to change.
1115+ var __importStar = ( this && this . __importStar ) || function ( mod ) {
1116+ if ( mod && mod . __esModule ) return mod ;
1117+ var result = { } ;
1118+ if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
1119+ result [ "default" ] = mod ;
1120+ return result ;
1121+ } ;
1122+ Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
1123+ // We use any as a valid input type
1124+ /* eslint-disable @typescript-eslint/no-explicit-any */
1125+ const fs = __importStar ( __webpack_require__ ( 747 ) ) ;
1126+ const os = __importStar ( __webpack_require__ ( 87 ) ) ;
1127+ const utils_1 = __webpack_require__ ( 82 ) ;
1128+ function issueCommand ( command , message ) {
1129+ const filePath = process . env [ `GITHUB_${ command } ` ] ;
1130+ if ( ! filePath ) {
1131+ throw new Error ( `Unable to find environment variable for file command ${ command } ` ) ;
1132+ }
1133+ if ( ! fs . existsSync ( filePath ) ) {
1134+ throw new Error ( `Missing file at path: ${ filePath } ` ) ;
1135+ }
1136+ fs . appendFileSync ( filePath , `${ utils_1 . toCommandValue ( message ) } ${ os . EOL } ` , {
1137+ encoding : 'utf8'
1138+ } ) ;
1139+ }
1140+ exports . issueCommand = issueCommand ;
1141+ //# sourceMappingURL=file-command.js.map
1142+
1143+ /***/ } ) ,
1144+
10831145/***/ 129 :
10841146/***/ ( function ( module ) {
10851147
@@ -3128,6 +3190,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
31283190} ;
31293191Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
31303192const os = __importStar ( __webpack_require__ ( 87 ) ) ;
3193+ const utils_1 = __webpack_require__ ( 82 ) ;
31313194/**
31323195 * Commands
31333196 *
@@ -3181,28 +3244,14 @@ class Command {
31813244 return cmdStr ;
31823245 }
31833246}
3184- /**
3185- * Sanitizes an input into a string so it can be passed into issueCommand safely
3186- * @param input input to sanitize into a string
3187- */
3188- function toCommandValue ( input ) {
3189- if ( input === null || input === undefined ) {
3190- return '' ;
3191- }
3192- else if ( typeof input === 'string' || input instanceof String ) {
3193- return input ;
3194- }
3195- return JSON . stringify ( input ) ;
3196- }
3197- exports . toCommandValue = toCommandValue ;
31983247function escapeData ( s ) {
3199- return toCommandValue ( s )
3248+ return utils_1 . toCommandValue ( s )
32003249 . replace ( / % / g, '%25' )
32013250 . replace ( / \r / g, '%0D' )
32023251 . replace ( / \n / g, '%0A' ) ;
32033252}
32043253function escapeProperty ( s ) {
3205- return toCommandValue ( s )
3254+ return utils_1 . toCommandValue ( s )
32063255 . replace ( / % / g, '%25' )
32073256 . replace ( / \r / g, '%0D' )
32083257 . replace ( / \n / g, '%0A' )
@@ -3236,6 +3285,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
32363285} ;
32373286Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
32383287const command_1 = __webpack_require__ ( 431 ) ;
3288+ const file_command_1 = __webpack_require__ ( 102 ) ;
3289+ const utils_1 = __webpack_require__ ( 82 ) ;
32393290const os = __importStar ( __webpack_require__ ( 87 ) ) ;
32403291const path = __importStar ( __webpack_require__ ( 622 ) ) ;
32413292/**
@@ -3262,9 +3313,17 @@ var ExitCode;
32623313 */
32633314// eslint-disable-next-line @typescript-eslint/no-explicit-any
32643315function exportVariable ( name , val ) {
3265- const convertedVal = command_1 . toCommandValue ( val ) ;
3316+ const convertedVal = utils_1 . toCommandValue ( val ) ;
32663317 process . env [ name ] = convertedVal ;
3267- command_1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
3318+ const filePath = process . env [ 'GITHUB_ENV' ] || '' ;
3319+ if ( filePath ) {
3320+ const delimiter = '_GitHubActionsFileCommandDelimeter_' ;
3321+ const commandValue = `${ name } <<${ delimiter } ${ os . EOL } ${ convertedVal } ${ os . EOL } ${ delimiter } ` ;
3322+ file_command_1 . issueCommand ( 'ENV' , commandValue ) ;
3323+ }
3324+ else {
3325+ command_1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
3326+ }
32683327}
32693328exports . exportVariable = exportVariable ;
32703329/**
@@ -3280,7 +3339,13 @@ exports.setSecret = setSecret;
32803339 * @param inputPath
32813340 */
32823341function addPath ( inputPath ) {
3283- command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
3342+ const filePath = process . env [ 'GITHUB_PATH' ] || '' ;
3343+ if ( filePath ) {
3344+ file_command_1 . issueCommand ( 'PATH' , inputPath ) ;
3345+ }
3346+ else {
3347+ command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
3348+ }
32843349 process . env [ 'PATH' ] = `${ inputPath } ${ path . delimiter } ${ process . env [ 'PATH' ] } ` ;
32853350}
32863351exports . addPath = addPath ;
0 commit comments