@@ -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/***/ 104 :
10841146/***/ ( function ( __unusedmodule , __unusedexports , __webpack_require__ ) {
10851147
@@ -3071,6 +3133,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
30713133} ;
30723134Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
30733135const os = __importStar ( __webpack_require__ ( 87 ) ) ;
3136+ const utils_1 = __webpack_require__ ( 82 ) ;
30743137/**
30753138 * Commands
30763139 *
@@ -3124,28 +3187,14 @@ class Command {
31243187 return cmdStr ;
31253188 }
31263189}
3127- /**
3128- * Sanitizes an input into a string so it can be passed into issueCommand safely
3129- * @param input input to sanitize into a string
3130- */
3131- function toCommandValue ( input ) {
3132- if ( input === null || input === undefined ) {
3133- return '' ;
3134- }
3135- else if ( typeof input === 'string' || input instanceof String ) {
3136- return input ;
3137- }
3138- return JSON . stringify ( input ) ;
3139- }
3140- exports . toCommandValue = toCommandValue ;
31413190function escapeData ( s ) {
3142- return toCommandValue ( s )
3191+ return utils_1 . toCommandValue ( s )
31433192 . replace ( / % / g, '%25' )
31443193 . replace ( / \r / g, '%0D' )
31453194 . replace ( / \n / g, '%0A' ) ;
31463195}
31473196function escapeProperty ( s ) {
3148- return toCommandValue ( s )
3197+ return utils_1 . toCommandValue ( s )
31493198 . replace ( / % / g, '%25' )
31503199 . replace ( / \r / g, '%0D' )
31513200 . replace ( / \n / g, '%0A' )
@@ -3179,6 +3228,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
31793228} ;
31803229Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
31813230const command_1 = __webpack_require__ ( 431 ) ;
3231+ const file_command_1 = __webpack_require__ ( 102 ) ;
3232+ const utils_1 = __webpack_require__ ( 82 ) ;
31823233const os = __importStar ( __webpack_require__ ( 87 ) ) ;
31833234const path = __importStar ( __webpack_require__ ( 622 ) ) ;
31843235/**
@@ -3205,9 +3256,17 @@ var ExitCode;
32053256 */
32063257// eslint-disable-next-line @typescript-eslint/no-explicit-any
32073258function exportVariable ( name , val ) {
3208- const convertedVal = command_1 . toCommandValue ( val ) ;
3259+ const convertedVal = utils_1 . toCommandValue ( val ) ;
32093260 process . env [ name ] = convertedVal ;
3210- command_1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
3261+ const filePath = process . env [ 'GITHUB_ENV' ] || '' ;
3262+ if ( filePath ) {
3263+ const delimiter = '_GitHubActionsFileCommandDelimeter_' ;
3264+ const commandValue = `${ name } <<${ delimiter } ${ os . EOL } ${ convertedVal } ${ os . EOL } ${ delimiter } ` ;
3265+ file_command_1 . issueCommand ( 'ENV' , commandValue ) ;
3266+ }
3267+ else {
3268+ command_1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
3269+ }
32113270}
32123271exports . exportVariable = exportVariable ;
32133272/**
@@ -3223,7 +3282,13 @@ exports.setSecret = setSecret;
32233282 * @param inputPath
32243283 */
32253284function addPath ( inputPath ) {
3226- command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
3285+ const filePath = process . env [ 'GITHUB_PATH' ] || '' ;
3286+ if ( filePath ) {
3287+ file_command_1 . issueCommand ( 'PATH' , inputPath ) ;
3288+ }
3289+ else {
3290+ command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
3291+ }
32273292 process . env [ 'PATH' ] = `${ inputPath } ${ path . delimiter } ${ process . env [ 'PATH' ] } ` ;
32283293}
32293294exports . addPath = addPath ;
0 commit comments