@@ -516,6 +516,32 @@ function onceStrict (fn) {
516516}
517517
518518
519+ /***/ } ) ,
520+
521+ /***/ 82 :
522+ /***/ ( function ( __unusedmodule , exports ) {
523+
524+ "use strict" ;
525+
526+ // We use any as a valid input type
527+ /* eslint-disable @typescript-eslint/no-explicit-any */
528+ Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
529+ /**
530+ * Sanitizes an input into a string so it can be passed into issueCommand safely
531+ * @param input input to sanitize into a string
532+ */
533+ function toCommandValue ( input ) {
534+ if ( input === null || input === undefined ) {
535+ return '' ;
536+ }
537+ else if ( typeof input === 'string' || input instanceof String ) {
538+ return input ;
539+ }
540+ return JSON . stringify ( input ) ;
541+ }
542+ exports . toCommandValue = toCommandValue ;
543+ //# sourceMappingURL=utils.js.map
544+
519545/***/ } ) ,
520546
521547/***/ 87 :
@@ -1453,6 +1479,42 @@ function regExpEscape (s) {
14531479}
14541480
14551481
1482+ /***/ } ) ,
1483+
1484+ /***/ 102 :
1485+ /***/ ( function ( __unusedmodule , exports , __webpack_require__ ) {
1486+
1487+ "use strict" ;
1488+
1489+ // For internal use, subject to change.
1490+ var __importStar = ( this && this . __importStar ) || function ( mod ) {
1491+ if ( mod && mod . __esModule ) return mod ;
1492+ var result = { } ;
1493+ if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
1494+ result [ "default" ] = mod ;
1495+ return result ;
1496+ } ;
1497+ Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
1498+ // We use any as a valid input type
1499+ /* eslint-disable @typescript-eslint/no-explicit-any */
1500+ const fs = __importStar ( __webpack_require__ ( 747 ) ) ;
1501+ const os = __importStar ( __webpack_require__ ( 87 ) ) ;
1502+ const utils_1 = __webpack_require__ ( 82 ) ;
1503+ function issueCommand ( command , message ) {
1504+ const filePath = process . env [ `GITHUB_${ command } ` ] ;
1505+ if ( ! filePath ) {
1506+ throw new Error ( `Unable to find environment variable for file command ${ command } ` ) ;
1507+ }
1508+ if ( ! fs . existsSync ( filePath ) ) {
1509+ throw new Error ( `Missing file at path: ${ filePath } ` ) ;
1510+ }
1511+ fs . appendFileSync ( filePath , `${ utils_1 . toCommandValue ( message ) } ${ os . EOL } ` , {
1512+ encoding : 'utf8'
1513+ } ) ;
1514+ }
1515+ exports . issueCommand = issueCommand ;
1516+ //# sourceMappingURL=file-command.js.map
1517+
14561518/***/ } ) ,
14571519
14581520/***/ 104 :
@@ -4912,6 +4974,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
49124974} ;
49134975Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
49144976const os = __importStar ( __webpack_require__ ( 87 ) ) ;
4977+ const utils_1 = __webpack_require__ ( 82 ) ;
49154978/**
49164979 * Commands
49174980 *
@@ -4965,28 +5028,14 @@ class Command {
49655028 return cmdStr ;
49665029 }
49675030}
4968- /**
4969- * Sanitizes an input into a string so it can be passed into issueCommand safely
4970- * @param input input to sanitize into a string
4971- */
4972- function toCommandValue ( input ) {
4973- if ( input === null || input === undefined ) {
4974- return '' ;
4975- }
4976- else if ( typeof input === 'string' || input instanceof String ) {
4977- return input ;
4978- }
4979- return JSON . stringify ( input ) ;
4980- }
4981- exports . toCommandValue = toCommandValue ;
49825031function escapeData ( s ) {
4983- return toCommandValue ( s )
5032+ return utils_1 . toCommandValue ( s )
49845033 . replace ( / % / g, '%25' )
49855034 . replace ( / \r / g, '%0D' )
49865035 . replace ( / \n / g, '%0A' ) ;
49875036}
49885037function escapeProperty ( s ) {
4989- return toCommandValue ( s )
5038+ return utils_1 . toCommandValue ( s )
49905039 . replace ( / % / g, '%25' )
49915040 . replace ( / \r / g, '%0D' )
49925041 . replace ( / \n / g, '%0A' )
@@ -5057,6 +5106,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
50575106} ;
50585107Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
50595108const command_1 = __webpack_require__ ( 431 ) ;
5109+ const file_command_1 = __webpack_require__ ( 102 ) ;
5110+ const utils_1 = __webpack_require__ ( 82 ) ;
50605111const os = __importStar ( __webpack_require__ ( 87 ) ) ;
50615112const path = __importStar ( __webpack_require__ ( 622 ) ) ;
50625113/**
@@ -5083,9 +5134,17 @@ var ExitCode;
50835134 */
50845135// eslint-disable-next-line @typescript-eslint/no-explicit-any
50855136function exportVariable ( name , val ) {
5086- const convertedVal = command_1 . toCommandValue ( val ) ;
5137+ const convertedVal = utils_1 . toCommandValue ( val ) ;
50875138 process . env [ name ] = convertedVal ;
5088- command_1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
5139+ const filePath = process . env [ 'GITHUB_ENV' ] || '' ;
5140+ if ( filePath ) {
5141+ const delimiter = '_GitHubActionsFileCommandDelimeter_' ;
5142+ const commandValue = `${ name } <<${ delimiter } ${ os . EOL } ${ convertedVal } ${ os . EOL } ${ delimiter } ` ;
5143+ file_command_1 . issueCommand ( 'ENV' , commandValue ) ;
5144+ }
5145+ else {
5146+ command_1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
5147+ }
50895148}
50905149exports . exportVariable = exportVariable ;
50915150/**
@@ -5101,7 +5160,13 @@ exports.setSecret = setSecret;
51015160 * @param inputPath
51025161 */
51035162function addPath ( inputPath ) {
5104- command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
5163+ const filePath = process . env [ 'GITHUB_PATH' ] || '' ;
5164+ if ( filePath ) {
5165+ file_command_1 . issueCommand ( 'PATH' , inputPath ) ;
5166+ }
5167+ else {
5168+ command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
5169+ }
51055170 process . env [ 'PATH' ] = `${ inputPath } ${ path . delimiter } ${ process . env [ 'PATH' ] } ` ;
51065171}
51075172exports . addPath = addPath ;
0 commit comments