@@ -947,13 +947,75 @@ class ExecState extends events.EventEmitter {
947947
948948/***/ } ) ,
949949
950+ /***/ 82 :
951+ /***/ ( function ( __unusedmodule , exports ) {
952+
953+ "use strict" ;
954+
955+ // We use any as a valid input type
956+ /* eslint-disable @typescript-eslint/no-explicit-any */
957+ Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
958+ /**
959+ * Sanitizes an input into a string so it can be passed into issueCommand safely
960+ * @param input input to sanitize into a string
961+ */
962+ function toCommandValue ( input ) {
963+ if ( input === null || input === undefined ) {
964+ return '' ;
965+ }
966+ else if ( typeof input === 'string' || input instanceof String ) {
967+ return input ;
968+ }
969+ return JSON . stringify ( input ) ;
970+ }
971+ exports . toCommandValue = toCommandValue ;
972+ //# sourceMappingURL=utils.js.map
973+
974+ /***/ } ) ,
975+
950976/***/ 87 :
951977/***/ ( function ( module ) {
952978
953979module . exports = require ( "os" ) ;
954980
955981/***/ } ) ,
956982
983+ /***/ 102 :
984+ /***/ ( function ( __unusedmodule , exports , __webpack_require__ ) {
985+
986+ "use strict" ;
987+
988+ // For internal use, subject to change.
989+ var __importStar = ( this && this . __importStar ) || function ( mod ) {
990+ if ( mod && mod . __esModule ) return mod ;
991+ var result = { } ;
992+ if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
993+ result [ "default" ] = mod ;
994+ return result ;
995+ } ;
996+ Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
997+ // We use any as a valid input type
998+ /* eslint-disable @typescript-eslint/no-explicit-any */
999+ const fs = __importStar ( __webpack_require__ ( 747 ) ) ;
1000+ const os = __importStar ( __webpack_require__ ( 87 ) ) ;
1001+ const utils_1 = __webpack_require__ ( 82 ) ;
1002+ function issueCommand ( command , message ) {
1003+ const filePath = process . env [ `GITHUB_${ command } ` ] ;
1004+ if ( ! filePath ) {
1005+ throw new Error ( `Unable to find environment variable for file command ${ command } ` ) ;
1006+ }
1007+ if ( ! fs . existsSync ( filePath ) ) {
1008+ throw new Error ( `Missing file at path: ${ filePath } ` ) ;
1009+ }
1010+ fs . appendFileSync ( filePath , `${ utils_1 . toCommandValue ( message ) } ${ os . EOL } ` , {
1011+ encoding : 'utf8'
1012+ } ) ;
1013+ }
1014+ exports . issueCommand = issueCommand ;
1015+ //# sourceMappingURL=file-command.js.map
1016+
1017+ /***/ } ) ,
1018+
9571019/***/ 104 :
9581020/***/ ( function ( __unusedmodule , __unusedexports , __webpack_require__ ) {
9591021
@@ -1027,6 +1089,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
10271089} ;
10281090Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
10291091const os = __importStar ( __webpack_require__ ( 87 ) ) ;
1092+ const utils_1 = __webpack_require__ ( 82 ) ;
10301093/**
10311094 * Commands
10321095 *
@@ -1080,28 +1143,14 @@ class Command {
10801143 return cmdStr ;
10811144 }
10821145}
1083- /**
1084- * Sanitizes an input into a string so it can be passed into issueCommand safely
1085- * @param input input to sanitize into a string
1086- */
1087- function toCommandValue ( input ) {
1088- if ( input === null || input === undefined ) {
1089- return '' ;
1090- }
1091- else if ( typeof input === 'string' || input instanceof String ) {
1092- return input ;
1093- }
1094- return JSON . stringify ( input ) ;
1095- }
1096- exports . toCommandValue = toCommandValue ;
10971146function escapeData ( s ) {
1098- return toCommandValue ( s )
1147+ return utils_1 . toCommandValue ( s )
10991148 . replace ( / % / g, '%25' )
11001149 . replace ( / \r / g, '%0D' )
11011150 . replace ( / \n / g, '%0A' ) ;
11021151}
11031152function escapeProperty ( s ) {
1104- return toCommandValue ( s )
1153+ return utils_1 . toCommandValue ( s )
11051154 . replace ( / % / g, '%25' )
11061155 . replace ( / \r / g, '%0D' )
11071156 . replace ( / \n / g, '%0A' )
@@ -1135,6 +1184,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
11351184} ;
11361185Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
11371186const command_1 = __webpack_require__ ( 431 ) ;
1187+ const file_command_1 = __webpack_require__ ( 102 ) ;
1188+ const utils_1 = __webpack_require__ ( 82 ) ;
11381189const os = __importStar ( __webpack_require__ ( 87 ) ) ;
11391190const path = __importStar ( __webpack_require__ ( 622 ) ) ;
11401191/**
@@ -1161,9 +1212,17 @@ var ExitCode;
11611212 */
11621213// eslint-disable-next-line @typescript-eslint/no-explicit-any
11631214function exportVariable ( name , val ) {
1164- const convertedVal = command_1 . toCommandValue ( val ) ;
1215+ const convertedVal = utils_1 . toCommandValue ( val ) ;
11651216 process . env [ name ] = convertedVal ;
1166- command_1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
1217+ const filePath = process . env [ 'GITHUB_ENV' ] || '' ;
1218+ if ( filePath ) {
1219+ const delimiter = '_GitHubActionsFileCommandDelimeter_' ;
1220+ const commandValue = `${ name } <<${ delimiter } ${ os . EOL } ${ convertedVal } ${ os . EOL } ${ delimiter } ` ;
1221+ file_command_1 . issueCommand ( 'ENV' , commandValue ) ;
1222+ }
1223+ else {
1224+ command_1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
1225+ }
11671226}
11681227exports . exportVariable = exportVariable ;
11691228/**
@@ -1179,7 +1238,13 @@ exports.setSecret = setSecret;
11791238 * @param inputPath
11801239 */
11811240function addPath ( inputPath ) {
1182- command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
1241+ const filePath = process . env [ 'GITHUB_PATH' ] || '' ;
1242+ if ( filePath ) {
1243+ file_command_1 . issueCommand ( 'PATH' , inputPath ) ;
1244+ }
1245+ else {
1246+ command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
1247+ }
11831248 process . env [ 'PATH' ] = `${ inputPath } ${ path . delimiter } ${ process . env [ 'PATH' ] } ` ;
11841249}
11851250exports . addPath = addPath ;
0 commit comments