@@ -953,6 +953,32 @@ class ExecState extends events.EventEmitter {
953
953
954
954
/***/ } ) ,
955
955
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
+
956
982
/***/ 86 :
957
983
/***/ ( function ( __unusedmodule , exports , __webpack_require__ ) {
958
984
@@ -1003,6 +1029,42 @@ module.exports = require("os");
1003
1029
1004
1030
/***/ } ) ,
1005
1031
1032
+ /***/ 102 :
1033
+ /***/ ( function ( __unusedmodule , exports , __webpack_require__ ) {
1034
+
1035
+ "use strict" ;
1036
+
1037
+ // For internal use, subject to change.
1038
+ var __importStar = ( this && this . __importStar ) || function ( mod ) {
1039
+ if ( mod && mod . __esModule ) return mod ;
1040
+ var result = { } ;
1041
+ if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
1042
+ result [ "default" ] = mod ;
1043
+ return result ;
1044
+ } ;
1045
+ Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
1046
+ // We use any as a valid input type
1047
+ /* eslint-disable @typescript-eslint/no-explicit-any */
1048
+ const fs = __importStar ( __webpack_require__ ( 747 ) ) ;
1049
+ const os = __importStar ( __webpack_require__ ( 87 ) ) ;
1050
+ const utils_1 = __webpack_require__ ( 82 ) ;
1051
+ function issueCommand ( command , message ) {
1052
+ const filePath = process . env [ `GITHUB_${ command } ` ] ;
1053
+ if ( ! filePath ) {
1054
+ throw new Error ( `Unable to find environment variable for file command ${ command } ` ) ;
1055
+ }
1056
+ if ( ! fs . existsSync ( filePath ) ) {
1057
+ throw new Error ( `Missing file at path: ${ filePath } ` ) ;
1058
+ }
1059
+ fs . appendFileSync ( filePath , `${ utils_1 . toCommandValue ( message ) } ${ os . EOL } ` , {
1060
+ encoding : 'utf8'
1061
+ } ) ;
1062
+ }
1063
+ exports . issueCommand = issueCommand ;
1064
+ //# sourceMappingURL=file-command.js.map
1065
+
1066
+ /***/ } ) ,
1067
+
1006
1068
/***/ 129 :
1007
1069
/***/ ( function ( module ) {
1008
1070
@@ -1348,6 +1410,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
1348
1410
} ;
1349
1411
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
1350
1412
const os = __importStar ( __webpack_require__ ( 87 ) ) ;
1413
+ const utils_1 = __webpack_require__ ( 82 ) ;
1351
1414
/**
1352
1415
* Commands
1353
1416
*
@@ -1401,28 +1464,14 @@ class Command {
1401
1464
return cmdStr ;
1402
1465
}
1403
1466
}
1404
- /**
1405
- * Sanitizes an input into a string so it can be passed into issueCommand safely
1406
- * @param input input to sanitize into a string
1407
- */
1408
- function toCommandValue ( input ) {
1409
- if ( input === null || input === undefined ) {
1410
- return '' ;
1411
- }
1412
- else if ( typeof input === 'string' || input instanceof String ) {
1413
- return input ;
1414
- }
1415
- return JSON . stringify ( input ) ;
1416
- }
1417
- exports . toCommandValue = toCommandValue ;
1418
1467
function escapeData ( s ) {
1419
- return toCommandValue ( s )
1468
+ return utils_1 . toCommandValue ( s )
1420
1469
. replace ( / % / g, '%25' )
1421
1470
. replace ( / \r / g, '%0D' )
1422
1471
. replace ( / \n / g, '%0A' ) ;
1423
1472
}
1424
1473
function escapeProperty ( s ) {
1425
- return toCommandValue ( s )
1474
+ return utils_1 . toCommandValue ( s )
1426
1475
. replace ( / % / g, '%25' )
1427
1476
. replace ( / \r / g, '%0D' )
1428
1477
. replace ( / \n / g, '%0A' )
@@ -1456,6 +1505,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
1456
1505
} ;
1457
1506
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
1458
1507
const command_1 = __webpack_require__ ( 431 ) ;
1508
+ const file_command_1 = __webpack_require__ ( 102 ) ;
1509
+ const utils_1 = __webpack_require__ ( 82 ) ;
1459
1510
const os = __importStar ( __webpack_require__ ( 87 ) ) ;
1460
1511
const path = __importStar ( __webpack_require__ ( 622 ) ) ;
1461
1512
/**
@@ -1482,9 +1533,17 @@ var ExitCode;
1482
1533
*/
1483
1534
// eslint-disable-next-line @typescript-eslint/no-explicit-any
1484
1535
function exportVariable ( name , val ) {
1485
- const convertedVal = command_1 . toCommandValue ( val ) ;
1536
+ const convertedVal = utils_1 . toCommandValue ( val ) ;
1486
1537
process . env [ name ] = convertedVal ;
1487
- command_1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
1538
+ const filePath = process . env [ 'GITHUB_ENV' ] || '' ;
1539
+ if ( filePath ) {
1540
+ const delimiter = '_GitHubActionsFileCommandDelimeter_' ;
1541
+ const commandValue = `${ name } <<${ delimiter } ${ os . EOL } ${ convertedVal } ${ os . EOL } ${ delimiter } ` ;
1542
+ file_command_1 . issueCommand ( 'ENV' , commandValue ) ;
1543
+ }
1544
+ else {
1545
+ command_1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
1546
+ }
1488
1547
}
1489
1548
exports . exportVariable = exportVariable ;
1490
1549
/**
@@ -1500,7 +1559,13 @@ exports.setSecret = setSecret;
1500
1559
* @param inputPath
1501
1560
*/
1502
1561
function addPath ( inputPath ) {
1503
- command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
1562
+ const filePath = process . env [ 'GITHUB_PATH' ] || '' ;
1563
+ if ( filePath ) {
1564
+ file_command_1 . issueCommand ( 'PATH' , inputPath ) ;
1565
+ }
1566
+ else {
1567
+ command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
1568
+ }
1504
1569
process . env [ 'PATH' ] = `${ inputPath } ${ path . delimiter } ${ process . env [ 'PATH' ] } ` ;
1505
1570
}
1506
1571
exports . addPath = addPath ;
0 commit comments