@@ -1428,6 +1428,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
14281428} ;
14291429Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
14301430const command_1 = __webpack_require__ ( 351 ) ;
1431+ const file_command_1 = __webpack_require__ ( 717 ) ;
1432+ const utils_1 = __webpack_require__ ( 278 ) ;
14311433const os = __importStar ( __webpack_require__ ( 87 ) ) ;
14321434const path = __importStar ( __webpack_require__ ( 622 ) ) ;
14331435/**
@@ -1454,9 +1456,17 @@ var ExitCode;
14541456 */
14551457// eslint-disable-next-line @typescript-eslint/no-explicit-any
14561458function exportVariable ( name , val ) {
1457- const convertedVal = command_1 . toCommandValue ( val ) ;
1459+ const convertedVal = utils_1 . toCommandValue ( val ) ;
14581460 process . env [ name ] = convertedVal ;
1459- command_1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
1461+ const filePath = process . env [ 'GITHUB_ENV' ] || '' ;
1462+ if ( filePath ) {
1463+ const delimiter = '_GitHubActionsFileCommandDelimeter_' ;
1464+ const commandValue = `${ name } <<${ delimiter } ${ os . EOL } ${ convertedVal } ${ os . EOL } ${ delimiter } ` ;
1465+ file_command_1 . issueCommand ( 'ENV' , commandValue ) ;
1466+ }
1467+ else {
1468+ command_1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
1469+ }
14601470}
14611471exports . exportVariable = exportVariable ;
14621472/**
@@ -1472,7 +1482,13 @@ exports.setSecret = setSecret;
14721482 * @param inputPath
14731483 */
14741484function addPath ( inputPath ) {
1475- command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
1485+ const filePath = process . env [ 'GITHUB_PATH' ] || '' ;
1486+ if ( filePath ) {
1487+ file_command_1 . issueCommand ( 'PATH' , inputPath ) ;
1488+ }
1489+ else {
1490+ command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
1491+ }
14761492 process . env [ 'PATH' ] = `${ inputPath } ${ path . delimiter } ${ process . env [ 'PATH' ] } ` ;
14771493}
14781494exports . addPath = addPath ;
@@ -2254,6 +2270,32 @@ exports.request = request;
22542270//# sourceMappingURL=index.js.map
22552271
22562272
2273+ /***/ } ) ,
2274+
2275+ /***/ 278 :
2276+ /***/ ( function ( __unusedmodule , exports ) {
2277+
2278+ "use strict" ;
2279+
2280+ // We use any as a valid input type
2281+ /* eslint-disable @typescript-eslint/no-explicit-any */
2282+ Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
2283+ /**
2284+ * Sanitizes an input into a string so it can be passed into issueCommand safely
2285+ * @param input input to sanitize into a string
2286+ */
2287+ function toCommandValue ( input ) {
2288+ if ( input === null || input === undefined ) {
2289+ return '' ;
2290+ }
2291+ else if ( typeof input === 'string' || input instanceof String ) {
2292+ return input ;
2293+ }
2294+ return JSON . stringify ( input ) ;
2295+ }
2296+ exports . toCommandValue = toCommandValue ;
2297+ //# sourceMappingURL=utils.js.map
2298+
22572299/***/ } ) ,
22582300
22592301/***/ 294 :
@@ -2335,6 +2377,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
23352377} ;
23362378Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
23372379const os = __importStar ( __webpack_require__ ( 87 ) ) ;
2380+ const utils_1 = __webpack_require__ ( 278 ) ;
23382381/**
23392382 * Commands
23402383 *
@@ -2388,28 +2431,14 @@ class Command {
23882431 return cmdStr ;
23892432 }
23902433}
2391- /**
2392- * Sanitizes an input into a string so it can be passed into issueCommand safely
2393- * @param input input to sanitize into a string
2394- */
2395- function toCommandValue ( input ) {
2396- if ( input === null || input === undefined ) {
2397- return '' ;
2398- }
2399- else if ( typeof input === 'string' || input instanceof String ) {
2400- return input ;
2401- }
2402- return JSON . stringify ( input ) ;
2403- }
2404- exports . toCommandValue = toCommandValue ;
24052434function escapeData ( s ) {
2406- return toCommandValue ( s )
2435+ return utils_1 . toCommandValue ( s )
24072436 . replace ( / % / g, '%25' )
24082437 . replace ( / \r / g, '%0D' )
24092438 . replace ( / \n / g, '%0A' ) ;
24102439}
24112440function escapeProperty ( s ) {
2412- return toCommandValue ( s )
2441+ return utils_1 . toCommandValue ( s )
24132442 . replace ( / % / g, '%25' )
24142443 . replace ( / \r / g, '%0D' )
24152444 . replace ( / \n / g, '%0A' )
@@ -5254,6 +5283,42 @@ module.exports.Singular = Hook.Singular
52545283module . exports . Collection = Hook . Collection
52555284
52565285
5286+ /***/ } ) ,
5287+
5288+ /***/ 717 :
5289+ /***/ ( function ( __unusedmodule , exports , __webpack_require__ ) {
5290+
5291+ "use strict" ;
5292+
5293+ // For internal use, subject to change.
5294+ var __importStar = ( this && this . __importStar ) || function ( mod ) {
5295+ if ( mod && mod . __esModule ) return mod ;
5296+ var result = { } ;
5297+ if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
5298+ result [ "default" ] = mod ;
5299+ return result ;
5300+ } ;
5301+ Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
5302+ // We use any as a valid input type
5303+ /* eslint-disable @typescript-eslint/no-explicit-any */
5304+ const fs = __importStar ( __webpack_require__ ( 747 ) ) ;
5305+ const os = __importStar ( __webpack_require__ ( 87 ) ) ;
5306+ const utils_1 = __webpack_require__ ( 278 ) ;
5307+ function issueCommand ( command , message ) {
5308+ const filePath = process . env [ `GITHUB_${ command } ` ] ;
5309+ if ( ! filePath ) {
5310+ throw new Error ( `Unable to find environment variable for file command ${ command } ` ) ;
5311+ }
5312+ if ( ! fs . existsSync ( filePath ) ) {
5313+ throw new Error ( `Missing file at path: ${ filePath } ` ) ;
5314+ }
5315+ fs . appendFileSync ( filePath , `${ utils_1 . toCommandValue ( message ) } ${ os . EOL } ` , {
5316+ encoding : 'utf8'
5317+ } ) ;
5318+ }
5319+ exports . issueCommand = issueCommand ;
5320+ //# sourceMappingURL=file-command.js.map
5321+
52575322/***/ } ) ,
52585323
52595324/***/ 720 :
0 commit comments