@@ -19,7 +19,13 @@ module.exports =
1919/******/ } ;
2020/******/
2121/******/ // Execute the module function
22- /******/ modules [ moduleId ] . call ( module . exports , module , module . exports , __webpack_require__ ) ;
22+ /******/ var threw = true ;
23+ /******/ try {
24+ /******/ modules [ moduleId ] . call ( module . exports , module , module . exports , __webpack_require__ ) ;
25+ /******/ threw = false ;
26+ /******/ } finally {
27+ /******/ if ( threw ) delete installedModules [ moduleId ] ;
28+ /******/ }
2329/******/
2430/******/ // Flag the module as loaded
2531/******/ module . l = true ;
@@ -947,13 +953,75 @@ class ExecState extends events.EventEmitter {
947953
948954/***/ } ) ,
949955
956+ /***/ 82 :
957+ /***/ ( function ( __unusedmodule , exports ) {
958+
959+ "use strict" ;
960+
961+ // We use any as a valid input type
962+ /* eslint-disable @typescript-eslint/no-explicit-any */
963+ Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
964+ /**
965+ * Sanitizes an input into a string so it can be passed into issueCommand safely
966+ * @param input input to sanitize into a string
967+ */
968+ function toCommandValue ( input ) {
969+ if ( input === null || input === undefined ) {
970+ return '' ;
971+ }
972+ else if ( typeof input === 'string' || input instanceof String ) {
973+ return input ;
974+ }
975+ return JSON . stringify ( input ) ;
976+ }
977+ exports . toCommandValue = toCommandValue ;
978+ //# sourceMappingURL=utils.js.map
979+
980+ /***/ } ) ,
981+
950982/***/ 87 :
951983/***/ ( function ( module ) {
952984
953985module . exports = require ( "os" ) ;
954986
955987/***/ } ) ,
956988
989+ /***/ 102 :
990+ /***/ ( function ( __unusedmodule , exports , __webpack_require__ ) {
991+
992+ "use strict" ;
993+
994+ // For internal use, subject to change.
995+ var __importStar = ( this && this . __importStar ) || function ( mod ) {
996+ if ( mod && mod . __esModule ) return mod ;
997+ var result = { } ;
998+ if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
999+ result [ "default" ] = mod ;
1000+ return result ;
1001+ } ;
1002+ Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
1003+ // We use any as a valid input type
1004+ /* eslint-disable @typescript-eslint/no-explicit-any */
1005+ const fs = __importStar ( __webpack_require__ ( 747 ) ) ;
1006+ const os = __importStar ( __webpack_require__ ( 87 ) ) ;
1007+ const utils_1 = __webpack_require__ ( 82 ) ;
1008+ function issueCommand ( command , message ) {
1009+ const filePath = process . env [ `GITHUB_${ command } ` ] ;
1010+ if ( ! filePath ) {
1011+ throw new Error ( `Unable to find environment variable for file command ${ command } ` ) ;
1012+ }
1013+ if ( ! fs . existsSync ( filePath ) ) {
1014+ throw new Error ( `Missing file at path: ${ filePath } ` ) ;
1015+ }
1016+ fs . appendFileSync ( filePath , `${ utils_1 . toCommandValue ( message ) } ${ os . EOL } ` , {
1017+ encoding : 'utf8'
1018+ } ) ;
1019+ }
1020+ exports . issueCommand = issueCommand ;
1021+ //# sourceMappingURL=file-command.js.map
1022+
1023+ /***/ } ) ,
1024+
9571025/***/ 129 :
9581026/***/ ( function ( module ) {
9591027
@@ -982,6 +1050,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
9821050} ;
9831051Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
9841052const os = __importStar ( __webpack_require__ ( 87 ) ) ;
1053+ const utils_1 = __webpack_require__ ( 82 ) ;
9851054/**
9861055 * Commands
9871056 *
@@ -1035,28 +1104,14 @@ class Command {
10351104 return cmdStr ;
10361105 }
10371106}
1038- /**
1039- * Sanitizes an input into a string so it can be passed into issueCommand safely
1040- * @param input input to sanitize into a string
1041- */
1042- function toCommandValue ( input ) {
1043- if ( input === null || input === undefined ) {
1044- return '' ;
1045- }
1046- else if ( typeof input === 'string' || input instanceof String ) {
1047- return input ;
1048- }
1049- return JSON . stringify ( input ) ;
1050- }
1051- exports . toCommandValue = toCommandValue ;
10521107function escapeData ( s ) {
1053- return toCommandValue ( s )
1108+ return utils_1 . toCommandValue ( s )
10541109 . replace ( / % / g, '%25' )
10551110 . replace ( / \r / g, '%0D' )
10561111 . replace ( / \n / g, '%0A' ) ;
10571112}
10581113function escapeProperty ( s ) {
1059- return toCommandValue ( s )
1114+ return utils_1 . toCommandValue ( s )
10601115 . replace ( / % / g, '%25' )
10611116 . replace ( / \r / g, '%0D' )
10621117 . replace ( / \n / g, '%0A' )
@@ -1090,6 +1145,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
10901145} ;
10911146Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
10921147const command_1 = __webpack_require__ ( 431 ) ;
1148+ const file_command_1 = __webpack_require__ ( 102 ) ;
1149+ const utils_1 = __webpack_require__ ( 82 ) ;
10931150const os = __importStar ( __webpack_require__ ( 87 ) ) ;
10941151const path = __importStar ( __webpack_require__ ( 622 ) ) ;
10951152/**
@@ -1116,9 +1173,17 @@ var ExitCode;
11161173 */
11171174// eslint-disable-next-line @typescript-eslint/no-explicit-any
11181175function exportVariable ( name , val ) {
1119- const convertedVal = command_1 . toCommandValue ( val ) ;
1176+ const convertedVal = utils_1 . toCommandValue ( val ) ;
11201177 process . env [ name ] = convertedVal ;
1121- command_1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
1178+ const filePath = process . env [ 'GITHUB_ENV' ] || '' ;
1179+ if ( filePath ) {
1180+ const delimiter = '_GitHubActionsFileCommandDelimeter_' ;
1181+ const commandValue = `${ name } <<${ delimiter } ${ os . EOL } ${ convertedVal } ${ os . EOL } ${ delimiter } ` ;
1182+ file_command_1 . issueCommand ( 'ENV' , commandValue ) ;
1183+ }
1184+ else {
1185+ command_1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
1186+ }
11221187}
11231188exports . exportVariable = exportVariable ;
11241189/**
@@ -1134,7 +1199,13 @@ exports.setSecret = setSecret;
11341199 * @param inputPath
11351200 */
11361201function addPath ( inputPath ) {
1137- command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
1202+ const filePath = process . env [ 'GITHUB_PATH' ] || '' ;
1203+ if ( filePath ) {
1204+ file_command_1 . issueCommand ( 'PATH' , inputPath ) ;
1205+ }
1206+ else {
1207+ command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
1208+ }
11381209 process . env [ 'PATH' ] = `${ inputPath } ${ path . delimiter } ${ process . env [ 'PATH' ] } ` ;
11391210}
11401211exports . addPath = addPath ;
0 commit comments