@@ -3028,6 +3028,32 @@ const windowsRelease = release => {
30283028module.exports = windowsRelease;
30293029
30303030
3031+ /***/ }),
3032+
3033+ /***/ 82:
3034+ /***/ (function(__unusedmodule, exports) {
3035+
3036+ "use strict";
3037+
3038+ // We use any as a valid input type
3039+ /* eslint-disable @typescript-eslint/no-explicit-any */
3040+ Object.defineProperty(exports, "__esModule", { value: true });
3041+ /**
3042+ * Sanitizes an input into a string so it can be passed into issueCommand safely
3043+ * @param input input to sanitize into a string
3044+ */
3045+ function toCommandValue(input) {
3046+ if (input === null || input === undefined) {
3047+ return '';
3048+ }
3049+ else if (typeof input === 'string' || input instanceof String) {
3050+ return input;
3051+ }
3052+ return JSON.stringify(input);
3053+ }
3054+ exports.toCommandValue = toCommandValue;
3055+ //# sourceMappingURL=utils.js.map
3056+
30313057/***/ }),
30323058
30333059/***/ 87:
@@ -3037,6 +3063,42 @@ module.exports = require("os");
30373063
30383064/***/ }),
30393065
3066+ /***/ 102:
3067+ /***/ (function(__unusedmodule, exports, __webpack_require__) {
3068+
3069+ "use strict";
3070+
3071+ // For internal use, subject to change.
3072+ var __importStar = (this && this.__importStar) || function (mod) {
3073+ if (mod && mod.__esModule) return mod;
3074+ var result = {};
3075+ if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
3076+ result["default"] = mod;
3077+ return result;
3078+ };
3079+ Object.defineProperty(exports, "__esModule", { value: true });
3080+ // We use any as a valid input type
3081+ /* eslint-disable @typescript-eslint/no-explicit-any */
3082+ const fs = __importStar(__webpack_require__(747));
3083+ const os = __importStar(__webpack_require__(87));
3084+ const utils_1 = __webpack_require__(82);
3085+ function issueCommand(command, message) {
3086+ const filePath = process.env[`GITHUB_${command}`];
3087+ if (!filePath) {
3088+ throw new Error(`Unable to find environment variable for file command ${command}`);
3089+ }
3090+ if (!fs.existsSync(filePath)) {
3091+ throw new Error(`Missing file at path: ${filePath}`);
3092+ }
3093+ fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {
3094+ encoding: 'utf8'
3095+ });
3096+ }
3097+ exports.issueCommand = issueCommand;
3098+ //# sourceMappingURL=file-command.js.map
3099+
3100+ /***/ }),
3101+
30403102/***/ 108:
30413103/***/ (function(module, __unusedexports, __webpack_require__) {
30423104
@@ -8396,6 +8458,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
83968458};
83978459Object.defineProperty(exports, "__esModule", { value: true });
83988460const os = __importStar(__webpack_require__(87));
8461+ const utils_1 = __webpack_require__(82);
83998462/**
84008463 * Commands
84018464 *
@@ -8450,13 +8513,13 @@ class Command {
84508513 }
84518514}
84528515function escapeData(s) {
8453- return (s || '' )
8516+ return utils_1.toCommandValue(s )
84548517 .replace(/%/g, '%25')
84558518 .replace(/\r/g, '%0D')
84568519 .replace(/\n/g, '%0A');
84578520}
84588521function escapeProperty(s) {
8459- return (s || '' )
8522+ return utils_1.toCommandValue(s )
84608523 .replace(/%/g, '%25')
84618524 .replace(/\r/g, '%0D')
84628525 .replace(/\n/g, '%0A')
@@ -10381,6 +10444,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
1038110444};
1038210445Object.defineProperty(exports, "__esModule", { value: true });
1038310446const command_1 = __webpack_require__(431);
10447+ const file_command_1 = __webpack_require__(102);
10448+ const utils_1 = __webpack_require__(82);
1038410449const os = __importStar(__webpack_require__(87));
1038510450const path = __importStar(__webpack_require__(622));
1038610451/**
@@ -10403,11 +10468,21 @@ var ExitCode;
1040310468/**
1040410469 * Sets env variable for this action and future actions in the job
1040510470 * @param name the name of the variable to set
10406- * @param val the value of the variable
10471+ * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
1040710472 */
10473+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1040810474function exportVariable(name, val) {
10409- process.env[name] = val;
10410- command_1.issueCommand('set-env', { name }, val);
10475+ const convertedVal = utils_1.toCommandValue(val);
10476+ process.env[name] = convertedVal;
10477+ const filePath = process.env['GITHUB_ENV'] || '';
10478+ if (filePath) {
10479+ const delimiter = '_GitHubActionsFileCommandDelimeter_';
10480+ const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
10481+ file_command_1.issueCommand('ENV', commandValue);
10482+ }
10483+ else {
10484+ command_1.issueCommand('set-env', { name }, convertedVal);
10485+ }
1041110486}
1041210487exports.exportVariable = exportVariable;
1041310488/**
@@ -10423,7 +10498,13 @@ exports.setSecret = setSecret;
1042310498 * @param inputPath
1042410499 */
1042510500function addPath(inputPath) {
10426- command_1.issueCommand('add-path', {}, inputPath);
10501+ const filePath = process.env['GITHUB_PATH'] || '';
10502+ if (filePath) {
10503+ file_command_1.issueCommand('PATH', inputPath);
10504+ }
10505+ else {
10506+ command_1.issueCommand('add-path', {}, inputPath);
10507+ }
1042710508 process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
1042810509}
1042910510exports.addPath = addPath;
@@ -10446,12 +10527,22 @@ exports.getInput = getInput;
1044610527 * Sets the value of an output.
1044710528 *
1044810529 * @param name name of the output to set
10449- * @param value value to store
10530+ * @param value value to store. Non-string values will be converted to a string via JSON.stringify
1045010531 */
10532+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1045110533function setOutput(name, value) {
1045210534 command_1.issueCommand('set-output', { name }, value);
1045310535}
1045410536exports.setOutput = setOutput;
10537+ /**
10538+ * Enables or disables the echoing of commands into stdout for the rest of the step.
10539+ * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
10540+ *
10541+ */
10542+ function setCommandEcho(enabled) {
10543+ command_1.issue('echo', enabled ? 'on' : 'off');
10544+ }
10545+ exports.setCommandEcho = setCommandEcho;
1045510546//-----------------------------------------------------------------------
1045610547// Results
1045710548//-----------------------------------------------------------------------
@@ -10468,6 +10559,13 @@ exports.setFailed = setFailed;
1046810559//-----------------------------------------------------------------------
1046910560// Logging Commands
1047010561//-----------------------------------------------------------------------
10562+ /**
10563+ * Gets whether Actions Step Debug is on or not
10564+ */
10565+ function isDebug() {
10566+ return process.env['RUNNER_DEBUG'] === '1';
10567+ }
10568+ exports.isDebug = isDebug;
1047110569/**
1047210570 * Writes debug message to user log
1047310571 * @param message debug message
@@ -10478,18 +10576,18 @@ function debug(message) {
1047810576exports.debug = debug;
1047910577/**
1048010578 * Adds an error issue
10481- * @param message error issue message
10579+ * @param message error issue message. Errors will be converted to string via toString()
1048210580 */
1048310581function error(message) {
10484- command_1.issue('error', message);
10582+ command_1.issue('error', message instanceof Error ? message.toString() : message );
1048510583}
1048610584exports.error = error;
1048710585/**
1048810586 * Adds an warning issue
10489- * @param message warning issue message
10587+ * @param message warning issue message. Errors will be converted to string via toString()
1049010588 */
1049110589function warning(message) {
10492- command_1.issue('warning', message);
10590+ command_1.issue('warning', message instanceof Error ? message.toString() : message );
1049310591}
1049410592exports.warning = warning;
1049510593/**
@@ -10547,8 +10645,9 @@ exports.group = group;
1054710645 * Saves state for current action, the state can only be retrieved by this action's post job execution.
1054810646 *
1054910647 * @param name name of the state to store
10550- * @param value value to store
10648+ * @param value value to store. Non-string values will be converted to a string via JSON.stringify
1055110649 */
10650+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1055210651function saveState(name, value) {
1055310652 command_1.issueCommand('save-state', { name }, value);
1055410653}
0 commit comments