@@ -2486,7 +2486,31 @@ function write(key, options) {
2486
2486
/* 79 */,
2487
2487
/* 80 */,
2488
2488
/* 81 */,
2489
- /* 82 */,
2489
+ /* 82 */
2490
+ /***/ (function(__unusedmodule, exports) {
2491
+
2492
+ "use strict";
2493
+
2494
+ // We use any as a valid input type
2495
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2496
+ Object.defineProperty(exports, "__esModule", { value: true });
2497
+ /**
2498
+ * Sanitizes an input into a string so it can be passed into issueCommand safely
2499
+ * @param input input to sanitize into a string
2500
+ */
2501
+ function toCommandValue(input) {
2502
+ if (input === null || input === undefined) {
2503
+ return '';
2504
+ }
2505
+ else if (typeof input === 'string' || input instanceof String) {
2506
+ return input;
2507
+ }
2508
+ return JSON.stringify(input);
2509
+ }
2510
+ exports.toCommandValue = toCommandValue;
2511
+ //# sourceMappingURL=utils.js.map
2512
+
2513
+ /***/ }),
2490
2514
/* 83 */,
2491
2515
/* 84 */,
2492
2516
/* 85 */
@@ -3722,7 +3746,41 @@ module.exports = {
3722
3746
/* 99 */,
3723
3747
/* 100 */,
3724
3748
/* 101 */,
3725
- /* 102 */,
3749
+ /* 102 */
3750
+ /***/ (function(__unusedmodule, exports, __webpack_require__) {
3751
+
3752
+ "use strict";
3753
+
3754
+ // For internal use, subject to change.
3755
+ var __importStar = (this && this.__importStar) || function (mod) {
3756
+ if (mod && mod.__esModule) return mod;
3757
+ var result = {};
3758
+ if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
3759
+ result["default"] = mod;
3760
+ return result;
3761
+ };
3762
+ Object.defineProperty(exports, "__esModule", { value: true });
3763
+ // We use any as a valid input type
3764
+ /* eslint-disable @typescript-eslint/no-explicit-any */
3765
+ const fs = __importStar(__webpack_require__(747));
3766
+ const os = __importStar(__webpack_require__(87));
3767
+ const utils_1 = __webpack_require__(82);
3768
+ function issueCommand(command, message) {
3769
+ const filePath = process.env[`GITHUB_${command}`];
3770
+ if (!filePath) {
3771
+ throw new Error(`Unable to find environment variable for file command ${command}`);
3772
+ }
3773
+ if (!fs.existsSync(filePath)) {
3774
+ throw new Error(`Missing file at path: ${filePath}`);
3775
+ }
3776
+ fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {
3777
+ encoding: 'utf8'
3778
+ });
3779
+ }
3780
+ exports.issueCommand = issueCommand;
3781
+ //# sourceMappingURL=file-command.js.map
3782
+
3783
+ /***/ }),
3726
3784
/* 103 */,
3727
3785
/* 104 */
3728
3786
/***/ (function(__unusedmodule, __unusedexports, __webpack_require__) {
@@ -22593,6 +22651,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
22593
22651
};
22594
22652
Object.defineProperty(exports, "__esModule", { value: true });
22595
22653
const os = __importStar(__webpack_require__(87));
22654
+ const utils_1 = __webpack_require__(82);
22596
22655
/**
22597
22656
* Commands
22598
22657
*
@@ -22647,13 +22706,13 @@ class Command {
22647
22706
}
22648
22707
}
22649
22708
function escapeData(s) {
22650
- return (s || '' )
22709
+ return utils_1.toCommandValue(s )
22651
22710
.replace(/%/g, '%25')
22652
22711
.replace(/\r/g, '%0D')
22653
22712
.replace(/\n/g, '%0A');
22654
22713
}
22655
22714
function escapeProperty(s) {
22656
- return (s || '' )
22715
+ return utils_1.toCommandValue(s )
22657
22716
.replace(/%/g, '%25')
22658
22717
.replace(/\r/g, '%0D')
22659
22718
.replace(/\n/g, '%0A')
@@ -26960,6 +27019,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
26960
27019
};
26961
27020
Object.defineProperty(exports, "__esModule", { value: true });
26962
27021
const command_1 = __webpack_require__(431);
27022
+ const file_command_1 = __webpack_require__(102);
27023
+ const utils_1 = __webpack_require__(82);
26963
27024
const os = __importStar(__webpack_require__(87));
26964
27025
const path = __importStar(__webpack_require__(622));
26965
27026
/**
@@ -26982,11 +27043,21 @@ var ExitCode;
26982
27043
/**
26983
27044
* Sets env variable for this action and future actions in the job
26984
27045
* @param name the name of the variable to set
26985
- * @param val the value of the variable
27046
+ * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
26986
27047
*/
27048
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
26987
27049
function exportVariable(name, val) {
26988
- process.env[name] = val;
26989
- command_1.issueCommand('set-env', { name }, val);
27050
+ const convertedVal = utils_1.toCommandValue(val);
27051
+ process.env[name] = convertedVal;
27052
+ const filePath = process.env['GITHUB_ENV'] || '';
27053
+ if (filePath) {
27054
+ const delimiter = '_GitHubActionsFileCommandDelimeter_';
27055
+ const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
27056
+ file_command_1.issueCommand('ENV', commandValue);
27057
+ }
27058
+ else {
27059
+ command_1.issueCommand('set-env', { name }, convertedVal);
27060
+ }
26990
27061
}
26991
27062
exports.exportVariable = exportVariable;
26992
27063
/**
@@ -27002,7 +27073,13 @@ exports.setSecret = setSecret;
27002
27073
* @param inputPath
27003
27074
*/
27004
27075
function addPath(inputPath) {
27005
- command_1.issueCommand('add-path', {}, inputPath);
27076
+ const filePath = process.env['GITHUB_PATH'] || '';
27077
+ if (filePath) {
27078
+ file_command_1.issueCommand('PATH', inputPath);
27079
+ }
27080
+ else {
27081
+ command_1.issueCommand('add-path', {}, inputPath);
27082
+ }
27006
27083
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
27007
27084
}
27008
27085
exports.addPath = addPath;
@@ -27025,12 +27102,22 @@ exports.getInput = getInput;
27025
27102
* Sets the value of an output.
27026
27103
*
27027
27104
* @param name name of the output to set
27028
- * @param value value to store
27105
+ * @param value value to store. Non-string values will be converted to a string via JSON.stringify
27029
27106
*/
27107
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
27030
27108
function setOutput(name, value) {
27031
27109
command_1.issueCommand('set-output', { name }, value);
27032
27110
}
27033
27111
exports.setOutput = setOutput;
27112
+ /**
27113
+ * Enables or disables the echoing of commands into stdout for the rest of the step.
27114
+ * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
27115
+ *
27116
+ */
27117
+ function setCommandEcho(enabled) {
27118
+ command_1.issue('echo', enabled ? 'on' : 'off');
27119
+ }
27120
+ exports.setCommandEcho = setCommandEcho;
27034
27121
//-----------------------------------------------------------------------
27035
27122
// Results
27036
27123
//-----------------------------------------------------------------------
@@ -27064,18 +27151,18 @@ function debug(message) {
27064
27151
exports.debug = debug;
27065
27152
/**
27066
27153
* Adds an error issue
27067
- * @param message error issue message
27154
+ * @param message error issue message. Errors will be converted to string via toString()
27068
27155
*/
27069
27156
function error(message) {
27070
- command_1.issue('error', message);
27157
+ command_1.issue('error', message instanceof Error ? message.toString() : message );
27071
27158
}
27072
27159
exports.error = error;
27073
27160
/**
27074
27161
* Adds an warning issue
27075
- * @param message warning issue message
27162
+ * @param message warning issue message. Errors will be converted to string via toString()
27076
27163
*/
27077
27164
function warning(message) {
27078
- command_1.issue('warning', message);
27165
+ command_1.issue('warning', message instanceof Error ? message.toString() : message );
27079
27166
}
27080
27167
exports.warning = warning;
27081
27168
/**
@@ -27133,8 +27220,9 @@ exports.group = group;
27133
27220
* Saves state for current action, the state can only be retrieved by this action's post job execution.
27134
27221
*
27135
27222
* @param name name of the state to store
27136
- * @param value value to store
27223
+ * @param value value to store. Non-string values will be converted to a string via JSON.stringify
27137
27224
*/
27225
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
27138
27226
function saveState(name, value) {
27139
27227
command_1.issueCommand('save-state', { name }, value);
27140
27228
}
0 commit comments