@@ -2883,6 +2883,32 @@ const windowsRelease = release => {
28832883module.exports = windowsRelease;
28842884
28852885
2886+ /***/ }),
2887+
2888+ /***/ 82:
2889+ /***/ (function(__unusedmodule, exports) {
2890+
2891+ "use strict";
2892+
2893+ // We use any as a valid input type
2894+ /* eslint-disable @typescript-eslint/no-explicit-any */
2895+ Object.defineProperty(exports, "__esModule", { value: true });
2896+ /**
2897+ * Sanitizes an input into a string so it can be passed into issueCommand safely
2898+ * @param input input to sanitize into a string
2899+ */
2900+ function toCommandValue(input) {
2901+ if (input === null || input === undefined) {
2902+ return '';
2903+ }
2904+ else if (typeof input === 'string' || input instanceof String) {
2905+ return input;
2906+ }
2907+ return JSON.stringify(input);
2908+ }
2909+ exports.toCommandValue = toCommandValue;
2910+ //# sourceMappingURL=utils.js.map
2911+
28862912/***/ }),
28872913
28882914/***/ 87:
@@ -2892,6 +2918,42 @@ module.exports = require("os");
28922918
28932919/***/ }),
28942920
2921+ /***/ 102:
2922+ /***/ (function(__unusedmodule, exports, __webpack_require__) {
2923+
2924+ "use strict";
2925+
2926+ // For internal use, subject to change.
2927+ var __importStar = (this && this.__importStar) || function (mod) {
2928+ if (mod && mod.__esModule) return mod;
2929+ var result = {};
2930+ if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
2931+ result["default"] = mod;
2932+ return result;
2933+ };
2934+ Object.defineProperty(exports, "__esModule", { value: true });
2935+ // We use any as a valid input type
2936+ /* eslint-disable @typescript-eslint/no-explicit-any */
2937+ const fs = __importStar(__webpack_require__(747));
2938+ const os = __importStar(__webpack_require__(87));
2939+ const utils_1 = __webpack_require__(82);
2940+ function issueCommand(command, message) {
2941+ const filePath = process.env[`GITHUB_${command}`];
2942+ if (!filePath) {
2943+ throw new Error(`Unable to find environment variable for file command ${command}`);
2944+ }
2945+ if (!fs.existsSync(filePath)) {
2946+ throw new Error(`Missing file at path: ${filePath}`);
2947+ }
2948+ fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {
2949+ encoding: 'utf8'
2950+ });
2951+ }
2952+ exports.issueCommand = issueCommand;
2953+ //# sourceMappingURL=file-command.js.map
2954+
2955+ /***/ }),
2956+
28952957/***/ 118:
28962958/***/ (function(module, __unusedexports, __webpack_require__) {
28972959
@@ -7596,6 +7658,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
75967658};
75977659Object.defineProperty(exports, "__esModule", { value: true });
75987660const os = __importStar(__webpack_require__(87));
7661+ const utils_1 = __webpack_require__(82);
75997662/**
76007663 * Commands
76017664 *
@@ -7650,13 +7713,13 @@ class Command {
76507713 }
76517714}
76527715function escapeData(s) {
7653- return (s || '' )
7716+ return utils_1.toCommandValue(s )
76547717 .replace(/%/g, '%25')
76557718 .replace(/\r/g, '%0D')
76567719 .replace(/\n/g, '%0A');
76577720}
76587721function escapeProperty(s) {
7659- return (s || '' )
7722+ return utils_1.toCommandValue(s )
76607723 .replace(/%/g, '%25')
76617724 .replace(/\r/g, '%0D')
76627725 .replace(/\n/g, '%0A')
@@ -9581,6 +9644,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
95819644};
95829645Object.defineProperty(exports, "__esModule", { value: true });
95839646const command_1 = __webpack_require__(431);
9647+ const file_command_1 = __webpack_require__(102);
9648+ const utils_1 = __webpack_require__(82);
95849649const os = __importStar(__webpack_require__(87));
95859650const path = __importStar(__webpack_require__(622));
95869651/**
@@ -9603,11 +9668,21 @@ var ExitCode;
96039668/**
96049669 * Sets env variable for this action and future actions in the job
96059670 * @param name the name of the variable to set
9606- * @param val the value of the variable
9671+ * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
96079672 */
9673+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
96089674function exportVariable(name, val) {
9609- process.env[name] = val;
9610- command_1.issueCommand('set-env', { name }, val);
9675+ const convertedVal = utils_1.toCommandValue(val);
9676+ process.env[name] = convertedVal;
9677+ const filePath = process.env['GITHUB_ENV'] || '';
9678+ if (filePath) {
9679+ const delimiter = '_GitHubActionsFileCommandDelimeter_';
9680+ const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
9681+ file_command_1.issueCommand('ENV', commandValue);
9682+ }
9683+ else {
9684+ command_1.issueCommand('set-env', { name }, convertedVal);
9685+ }
96119686}
96129687exports.exportVariable = exportVariable;
96139688/**
@@ -9623,7 +9698,13 @@ exports.setSecret = setSecret;
96239698 * @param inputPath
96249699 */
96259700function addPath(inputPath) {
9626- command_1.issueCommand('add-path', {}, inputPath);
9701+ const filePath = process.env['GITHUB_PATH'] || '';
9702+ if (filePath) {
9703+ file_command_1.issueCommand('PATH', inputPath);
9704+ }
9705+ else {
9706+ command_1.issueCommand('add-path', {}, inputPath);
9707+ }
96279708 process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
96289709}
96299710exports.addPath = addPath;
@@ -9646,12 +9727,22 @@ exports.getInput = getInput;
96469727 * Sets the value of an output.
96479728 *
96489729 * @param name name of the output to set
9649- * @param value value to store
9730+ * @param value value to store. Non-string values will be converted to a string via JSON.stringify
96509731 */
9732+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
96519733function setOutput(name, value) {
96529734 command_1.issueCommand('set-output', { name }, value);
96539735}
96549736exports.setOutput = setOutput;
9737+ /**
9738+ * Enables or disables the echoing of commands into stdout for the rest of the step.
9739+ * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
9740+ *
9741+ */
9742+ function setCommandEcho(enabled) {
9743+ command_1.issue('echo', enabled ? 'on' : 'off');
9744+ }
9745+ exports.setCommandEcho = setCommandEcho;
96559746//-----------------------------------------------------------------------
96569747// Results
96579748//-----------------------------------------------------------------------
@@ -9668,6 +9759,13 @@ exports.setFailed = setFailed;
96689759//-----------------------------------------------------------------------
96699760// Logging Commands
96709761//-----------------------------------------------------------------------
9762+ /**
9763+ * Gets whether Actions Step Debug is on or not
9764+ */
9765+ function isDebug() {
9766+ return process.env['RUNNER_DEBUG'] === '1';
9767+ }
9768+ exports.isDebug = isDebug;
96719769/**
96729770 * Writes debug message to user log
96739771 * @param message debug message
@@ -9678,18 +9776,18 @@ function debug(message) {
96789776exports.debug = debug;
96799777/**
96809778 * Adds an error issue
9681- * @param message error issue message
9779+ * @param message error issue message. Errors will be converted to string via toString()
96829780 */
96839781function error(message) {
9684- command_1.issue('error', message);
9782+ command_1.issue('error', message instanceof Error ? message.toString() : message );
96859783}
96869784exports.error = error;
96879785/**
96889786 * Adds an warning issue
9689- * @param message warning issue message
9787+ * @param message warning issue message. Errors will be converted to string via toString()
96909788 */
96919789function warning(message) {
9692- command_1.issue('warning', message);
9790+ command_1.issue('warning', message instanceof Error ? message.toString() : message );
96939791}
96949792exports.warning = warning;
96959793/**
@@ -9747,8 +9845,9 @@ exports.group = group;
97479845 * Saves state for current action, the state can only be retrieved by this action's post job execution.
97489846 *
97499847 * @param name name of the state to store
9750- * @param value value to store
9848+ * @param value value to store. Non-string values will be converted to a string via JSON.stringify
97519849 */
9850+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
97529851function saveState(name, value) {
97539852 command_1.issueCommand('save-state', { name }, value);
97549853}
0 commit comments