@@ -137,6 +137,32 @@ function onceStrict (fn) {
137137}
138138
139139
140+ /***/ } ) ,
141+
142+ /***/ 82 :
143+ /***/ ( function ( __unusedmodule , exports ) {
144+
145+ "use strict" ;
146+
147+ // We use any as a valid input type
148+ /* eslint-disable @typescript-eslint/no-explicit-any */
149+ Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
150+ /**
151+ * Sanitizes an input into a string so it can be passed into issueCommand safely
152+ * @param input input to sanitize into a string
153+ */
154+ function toCommandValue ( input ) {
155+ if ( input === null || input === undefined ) {
156+ return '' ;
157+ }
158+ else if ( typeof input === 'string' || input instanceof String ) {
159+ return input ;
160+ }
161+ return JSON . stringify ( input ) ;
162+ }
163+ exports . toCommandValue = toCommandValue ;
164+ //# sourceMappingURL=utils.js.map
165+
140166/***/ } ) ,
141167
142168/***/ 87 :
@@ -1074,6 +1100,42 @@ function regExpEscape (s) {
10741100}
10751101
10761102
1103+ /***/ } ) ,
1104+
1105+ /***/ 102 :
1106+ /***/ ( function ( __unusedmodule , exports , __webpack_require__ ) {
1107+
1108+ "use strict" ;
1109+
1110+ // For internal use, subject to change.
1111+ var __importStar = ( this && this . __importStar ) || function ( mod ) {
1112+ if ( mod && mod . __esModule ) return mod ;
1113+ var result = { } ;
1114+ if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
1115+ result [ "default" ] = mod ;
1116+ return result ;
1117+ } ;
1118+ Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
1119+ // We use any as a valid input type
1120+ /* eslint-disable @typescript-eslint/no-explicit-any */
1121+ const fs = __importStar ( __webpack_require__ ( 747 ) ) ;
1122+ const os = __importStar ( __webpack_require__ ( 87 ) ) ;
1123+ const utils_1 = __webpack_require__ ( 82 ) ;
1124+ function issueCommand ( command , message ) {
1125+ const filePath = process . env [ `GITHUB_${ command } ` ] ;
1126+ if ( ! filePath ) {
1127+ throw new Error ( `Unable to find environment variable for file command ${ command } ` ) ;
1128+ }
1129+ if ( ! fs . existsSync ( filePath ) ) {
1130+ throw new Error ( `Missing file at path: ${ filePath } ` ) ;
1131+ }
1132+ fs . appendFileSync ( filePath , `${ utils_1 . toCommandValue ( message ) } ${ os . EOL } ` , {
1133+ encoding : 'utf8'
1134+ } ) ;
1135+ }
1136+ exports . issueCommand = issueCommand ;
1137+ //# sourceMappingURL=file-command.js.map
1138+
10771139/***/ } ) ,
10781140
10791141/***/ 117 :
@@ -4460,6 +4522,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
44604522} ;
44614523Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
44624524const os = __importStar ( __webpack_require__ ( 87 ) ) ;
4525+ const utils_1 = __webpack_require__ ( 82 ) ;
44634526/**
44644527 * Commands
44654528 *
@@ -4513,28 +4576,14 @@ class Command {
45134576 return cmdStr ;
45144577 }
45154578}
4516- /**
4517- * Sanitizes an input into a string so it can be passed into issueCommand safely
4518- * @param input input to sanitize into a string
4519- */
4520- function toCommandValue ( input ) {
4521- if ( input === null || input === undefined ) {
4522- return '' ;
4523- }
4524- else if ( typeof input === 'string' || input instanceof String ) {
4525- return input ;
4526- }
4527- return JSON . stringify ( input ) ;
4528- }
4529- exports . toCommandValue = toCommandValue ;
45304579function escapeData ( s ) {
4531- return toCommandValue ( s )
4580+ return utils_1 . toCommandValue ( s )
45324581 . replace ( / % / g, '%25' )
45334582 . replace ( / \r / g, '%0D' )
45344583 . replace ( / \n / g, '%0A' ) ;
45354584}
45364585function escapeProperty ( s ) {
4537- return toCommandValue ( s )
4586+ return utils_1 . toCommandValue ( s )
45384587 . replace ( / % / g, '%25' )
45394588 . replace ( / \r / g, '%0D' )
45404589 . replace ( / \n / g, '%0A' )
@@ -4606,6 +4655,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
46064655} ;
46074656Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
46084657const command_1 = __webpack_require__ ( 431 ) ;
4658+ const file_command_1 = __webpack_require__ ( 102 ) ;
4659+ const utils_1 = __webpack_require__ ( 82 ) ;
46094660const os = __importStar ( __webpack_require__ ( 87 ) ) ;
46104661const path = __importStar ( __webpack_require__ ( 622 ) ) ;
46114662/**
@@ -4632,9 +4683,17 @@ var ExitCode;
46324683 */
46334684// eslint-disable-next-line @typescript-eslint/no-explicit-any
46344685function exportVariable ( name , val ) {
4635- const convertedVal = command_1 . toCommandValue ( val ) ;
4686+ const convertedVal = utils_1 . toCommandValue ( val ) ;
46364687 process . env [ name ] = convertedVal ;
4637- command_1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
4688+ const filePath = process . env [ 'GITHUB_ENV' ] || '' ;
4689+ if ( filePath ) {
4690+ const delimiter = '_GitHubActionsFileCommandDelimeter_' ;
4691+ const commandValue = `${ name } <<${ delimiter } ${ os . EOL } ${ convertedVal } ${ os . EOL } ${ delimiter } ` ;
4692+ file_command_1 . issueCommand ( 'ENV' , commandValue ) ;
4693+ }
4694+ else {
4695+ command_1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
4696+ }
46384697}
46394698exports . exportVariable = exportVariable ;
46404699/**
@@ -4650,7 +4709,13 @@ exports.setSecret = setSecret;
46504709 * @param inputPath
46514710 */
46524711function addPath ( inputPath ) {
4653- command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
4712+ const filePath = process . env [ 'GITHUB_PATH' ] || '' ;
4713+ if ( filePath ) {
4714+ file_command_1 . issueCommand ( 'PATH' , inputPath ) ;
4715+ }
4716+ else {
4717+ command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
4718+ }
46544719 process . env [ 'PATH' ] = `${ inputPath } ${ path . delimiter } ${ process . env [ 'PATH' ] } ` ;
46554720}
46564721exports . addPath = addPath ;
0 commit comments