@@ -1616,6 +1616,32 @@ exports.default = _default;
1616
1616
1617
1617
/***/ }),
1618
1618
1619
+ /***/ 82:
1620
+ /***/ (function(__unusedmodule, exports) {
1621
+
1622
+ "use strict";
1623
+
1624
+ // We use any as a valid input type
1625
+ /* eslint-disable @typescript-eslint/no-explicit-any */
1626
+ Object.defineProperty(exports, "__esModule", { value: true });
1627
+ /**
1628
+ * Sanitizes an input into a string so it can be passed into issueCommand safely
1629
+ * @param input input to sanitize into a string
1630
+ */
1631
+ function toCommandValue(input) {
1632
+ if (input === null || input === undefined) {
1633
+ return '';
1634
+ }
1635
+ else if (typeof input === 'string' || input instanceof String) {
1636
+ return input;
1637
+ }
1638
+ return JSON.stringify(input);
1639
+ }
1640
+ exports.toCommandValue = toCommandValue;
1641
+ //# sourceMappingURL=utils.js.map
1642
+
1643
+ /***/ }),
1644
+
1619
1645
/***/ 87:
1620
1646
/***/ (function(module) {
1621
1647
@@ -2551,6 +2577,42 @@ function regExpEscape (s) {
2551
2577
}
2552
2578
2553
2579
2580
+ /***/ }),
2581
+
2582
+ /***/ 102:
2583
+ /***/ (function(__unusedmodule, exports, __webpack_require__) {
2584
+
2585
+ "use strict";
2586
+
2587
+ // For internal use, subject to change.
2588
+ var __importStar = (this && this.__importStar) || function (mod) {
2589
+ if (mod && mod.__esModule) return mod;
2590
+ var result = {};
2591
+ if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
2592
+ result["default"] = mod;
2593
+ return result;
2594
+ };
2595
+ Object.defineProperty(exports, "__esModule", { value: true });
2596
+ // We use any as a valid input type
2597
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2598
+ const fs = __importStar(__webpack_require__(747));
2599
+ const os = __importStar(__webpack_require__(87));
2600
+ const utils_1 = __webpack_require__(82);
2601
+ function issueCommand(command, message) {
2602
+ const filePath = process.env[`GITHUB_${command}`];
2603
+ if (!filePath) {
2604
+ throw new Error(`Unable to find environment variable for file command ${command}`);
2605
+ }
2606
+ if (!fs.existsSync(filePath)) {
2607
+ throw new Error(`Missing file at path: ${filePath}`);
2608
+ }
2609
+ fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {
2610
+ encoding: 'utf8'
2611
+ });
2612
+ }
2613
+ exports.issueCommand = issueCommand;
2614
+ //# sourceMappingURL=file-command.js.map
2615
+
2554
2616
/***/ }),
2555
2617
2556
2618
/***/ 109:
@@ -8840,6 +8902,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
8840
8902
};
8841
8903
Object.defineProperty(exports, "__esModule", { value: true });
8842
8904
const os = __importStar(__webpack_require__(87));
8905
+ const utils_1 = __webpack_require__(82);
8843
8906
/**
8844
8907
* Commands
8845
8908
*
@@ -8893,28 +8956,14 @@ class Command {
8893
8956
return cmdStr;
8894
8957
}
8895
8958
}
8896
- /**
8897
- * Sanitizes an input into a string so it can be passed into issueCommand safely
8898
- * @param input input to sanitize into a string
8899
- */
8900
- function toCommandValue(input) {
8901
- if (input === null || input === undefined) {
8902
- return '';
8903
- }
8904
- else if (typeof input === 'string' || input instanceof String) {
8905
- return input;
8906
- }
8907
- return JSON.stringify(input);
8908
- }
8909
- exports.toCommandValue = toCommandValue;
8910
8959
function escapeData(s) {
8911
- return toCommandValue(s)
8960
+ return utils_1. toCommandValue(s)
8912
8961
.replace(/%/g, '%25')
8913
8962
.replace(/\r/g, '%0D')
8914
8963
.replace(/\n/g, '%0A');
8915
8964
}
8916
8965
function escapeProperty(s) {
8917
- return toCommandValue(s)
8966
+ return utils_1. toCommandValue(s)
8918
8967
.replace(/%/g, '%25')
8919
8968
.replace(/\r/g, '%0D')
8920
8969
.replace(/\n/g, '%0A')
@@ -10941,6 +10990,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
10941
10990
};
10942
10991
Object.defineProperty(exports, "__esModule", { value: true });
10943
10992
const command_1 = __webpack_require__(431);
10993
+ const file_command_1 = __webpack_require__(102);
10994
+ const utils_1 = __webpack_require__(82);
10944
10995
const os = __importStar(__webpack_require__(87));
10945
10996
const path = __importStar(__webpack_require__(622));
10946
10997
/**
@@ -10967,9 +11018,17 @@ var ExitCode;
10967
11018
*/
10968
11019
// eslint-disable-next-line @typescript-eslint/no-explicit-any
10969
11020
function exportVariable(name, val) {
10970
- const convertedVal = command_1 .toCommandValue(val);
11021
+ const convertedVal = utils_1 .toCommandValue(val);
10971
11022
process.env[name] = convertedVal;
10972
- command_1.issueCommand('set-env', { name }, convertedVal);
11023
+ const filePath = process.env['GITHUB_ENV'] || '';
11024
+ if (filePath) {
11025
+ const delimiter = '_GitHubActionsFileCommandDelimeter_';
11026
+ const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
11027
+ file_command_1.issueCommand('ENV', commandValue);
11028
+ }
11029
+ else {
11030
+ command_1.issueCommand('set-env', { name }, convertedVal);
11031
+ }
10973
11032
}
10974
11033
exports.exportVariable = exportVariable;
10975
11034
/**
@@ -10985,7 +11044,13 @@ exports.setSecret = setSecret;
10985
11044
* @param inputPath
10986
11045
*/
10987
11046
function addPath(inputPath) {
10988
- command_1.issueCommand('add-path', {}, inputPath);
11047
+ const filePath = process.env['GITHUB_PATH'] || '';
11048
+ if (filePath) {
11049
+ file_command_1.issueCommand('PATH', inputPath);
11050
+ }
11051
+ else {
11052
+ command_1.issueCommand('add-path', {}, inputPath);
11053
+ }
10989
11054
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
10990
11055
}
10991
11056
exports.addPath = addPath;
0 commit comments