@@ -1428,6 +1428,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
1428
1428
} ;
1429
1429
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
1430
1430
const command_1 = __webpack_require__ ( 351 ) ;
1431
+ const file_command_1 = __webpack_require__ ( 717 ) ;
1432
+ const utils_1 = __webpack_require__ ( 278 ) ;
1431
1433
const os = __importStar ( __webpack_require__ ( 87 ) ) ;
1432
1434
const path = __importStar ( __webpack_require__ ( 622 ) ) ;
1433
1435
/**
@@ -1454,9 +1456,17 @@ var ExitCode;
1454
1456
*/
1455
1457
// eslint-disable-next-line @typescript-eslint/no-explicit-any
1456
1458
function exportVariable ( name , val ) {
1457
- const convertedVal = command_1 . toCommandValue ( val ) ;
1459
+ const convertedVal = utils_1 . toCommandValue ( val ) ;
1458
1460
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
+ }
1460
1470
}
1461
1471
exports . exportVariable = exportVariable ;
1462
1472
/**
@@ -1472,7 +1482,13 @@ exports.setSecret = setSecret;
1472
1482
* @param inputPath
1473
1483
*/
1474
1484
function 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
+ }
1476
1492
process . env [ 'PATH' ] = `${ inputPath } ${ path . delimiter } ${ process . env [ 'PATH' ] } ` ;
1477
1493
}
1478
1494
exports . addPath = addPath ;
@@ -2254,6 +2270,32 @@ exports.request = request;
2254
2270
//# sourceMappingURL=index.js.map
2255
2271
2256
2272
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
+
2257
2299
/***/ } ) ,
2258
2300
2259
2301
/***/ 294 :
@@ -2335,6 +2377,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
2335
2377
} ;
2336
2378
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
2337
2379
const os = __importStar ( __webpack_require__ ( 87 ) ) ;
2380
+ const utils_1 = __webpack_require__ ( 278 ) ;
2338
2381
/**
2339
2382
* Commands
2340
2383
*
@@ -2388,28 +2431,14 @@ class Command {
2388
2431
return cmdStr ;
2389
2432
}
2390
2433
}
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 ;
2405
2434
function escapeData ( s ) {
2406
- return toCommandValue ( s )
2435
+ return utils_1 . toCommandValue ( s )
2407
2436
. replace ( / % / g, '%25' )
2408
2437
. replace ( / \r / g, '%0D' )
2409
2438
. replace ( / \n / g, '%0A' ) ;
2410
2439
}
2411
2440
function escapeProperty ( s ) {
2412
- return toCommandValue ( s )
2441
+ return utils_1 . toCommandValue ( s )
2413
2442
. replace ( / % / g, '%25' )
2414
2443
. replace ( / \r / g, '%0D' )
2415
2444
. replace ( / \n / g, '%0A' )
@@ -5254,6 +5283,42 @@ module.exports.Singular = Hook.Singular
5254
5283
module . exports . Collection = Hook . Collection
5255
5284
5256
5285
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
+
5257
5322
/***/ } ) ,
5258
5323
5259
5324
/***/ 720 :
0 commit comments