@@ -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
@@ -8406,6 +8468,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
84068468};
84078469Object.defineProperty(exports, "__esModule", { value: true });
84088470const os = __importStar(__webpack_require__(87));
8471+ const utils_1 = __webpack_require__(82);
84098472/**
84108473 * Commands
84118474 *
@@ -8460,13 +8523,13 @@ class Command {
84608523 }
84618524}
84628525function escapeData(s) {
8463- return (s || '' )
8526+ return utils_1.toCommandValue(s )
84648527 .replace(/%/g, '%25')
84658528 .replace(/\r/g, '%0D')
84668529 .replace(/\n/g, '%0A');
84678530}
84688531function escapeProperty(s) {
8469- return (s || '' )
8532+ return utils_1.toCommandValue(s )
84708533 .replace(/%/g, '%25')
84718534 .replace(/\r/g, '%0D')
84728535 .replace(/\n/g, '%0A')
@@ -10391,6 +10454,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
1039110454};
1039210455Object.defineProperty(exports, "__esModule", { value: true });
1039310456const command_1 = __webpack_require__(431);
10457+ const file_command_1 = __webpack_require__(102);
10458+ const utils_1 = __webpack_require__(82);
1039410459const os = __importStar(__webpack_require__(87));
1039510460const path = __importStar(__webpack_require__(622));
1039610461/**
@@ -10413,11 +10478,21 @@ var ExitCode;
1041310478/**
1041410479 * Sets env variable for this action and future actions in the job
1041510480 * @param name the name of the variable to set
10416- * @param val the value of the variable
10481+ * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
1041710482 */
10483+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1041810484function exportVariable(name, val) {
10419- process.env[name] = val;
10420- command_1.issueCommand('set-env', { name }, val);
10485+ const convertedVal = utils_1.toCommandValue(val);
10486+ process.env[name] = convertedVal;
10487+ const filePath = process.env['GITHUB_ENV'] || '';
10488+ if (filePath) {
10489+ const delimiter = '_GitHubActionsFileCommandDelimeter_';
10490+ const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
10491+ file_command_1.issueCommand('ENV', commandValue);
10492+ }
10493+ else {
10494+ command_1.issueCommand('set-env', { name }, convertedVal);
10495+ }
1042110496}
1042210497exports.exportVariable = exportVariable;
1042310498/**
@@ -10433,7 +10508,13 @@ exports.setSecret = setSecret;
1043310508 * @param inputPath
1043410509 */
1043510510function addPath(inputPath) {
10436- command_1.issueCommand('add-path', {}, inputPath);
10511+ const filePath = process.env['GITHUB_PATH'] || '';
10512+ if (filePath) {
10513+ file_command_1.issueCommand('PATH', inputPath);
10514+ }
10515+ else {
10516+ command_1.issueCommand('add-path', {}, inputPath);
10517+ }
1043710518 process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
1043810519}
1043910520exports.addPath = addPath;
@@ -10456,12 +10537,22 @@ exports.getInput = getInput;
1045610537 * Sets the value of an output.
1045710538 *
1045810539 * @param name name of the output to set
10459- * @param value value to store
10540+ * @param value value to store. Non-string values will be converted to a string via JSON.stringify
1046010541 */
10542+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1046110543function setOutput(name, value) {
1046210544 command_1.issueCommand('set-output', { name }, value);
1046310545}
1046410546exports.setOutput = setOutput;
10547+ /**
10548+ * Enables or disables the echoing of commands into stdout for the rest of the step.
10549+ * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
10550+ *
10551+ */
10552+ function setCommandEcho(enabled) {
10553+ command_1.issue('echo', enabled ? 'on' : 'off');
10554+ }
10555+ exports.setCommandEcho = setCommandEcho;
1046510556//-----------------------------------------------------------------------
1046610557// Results
1046710558//-----------------------------------------------------------------------
@@ -10478,6 +10569,13 @@ exports.setFailed = setFailed;
1047810569//-----------------------------------------------------------------------
1047910570// Logging Commands
1048010571//-----------------------------------------------------------------------
10572+ /**
10573+ * Gets whether Actions Step Debug is on or not
10574+ */
10575+ function isDebug() {
10576+ return process.env['RUNNER_DEBUG'] === '1';
10577+ }
10578+ exports.isDebug = isDebug;
1048110579/**
1048210580 * Writes debug message to user log
1048310581 * @param message debug message
@@ -10488,18 +10586,18 @@ function debug(message) {
1048810586exports.debug = debug;
1048910587/**
1049010588 * Adds an error issue
10491- * @param message error issue message
10589+ * @param message error issue message. Errors will be converted to string via toString()
1049210590 */
1049310591function error(message) {
10494- command_1.issue('error', message);
10592+ command_1.issue('error', message instanceof Error ? message.toString() : message );
1049510593}
1049610594exports.error = error;
1049710595/**
1049810596 * Adds an warning issue
10499- * @param message warning issue message
10597+ * @param message warning issue message. Errors will be converted to string via toString()
1050010598 */
1050110599function warning(message) {
10502- command_1.issue('warning', message);
10600+ command_1.issue('warning', message instanceof Error ? message.toString() : message );
1050310601}
1050410602exports.warning = warning;
1050510603/**
@@ -10557,8 +10655,9 @@ exports.group = group;
1055710655 * Saves state for current action, the state can only be retrieved by this action's post job execution.
1055810656 *
1055910657 * @param name name of the state to store
10560- * @param value value to store
10658+ * @param value value to store. Non-string values will be converted to a string via JSON.stringify
1056110659 */
10660+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1056210661function saveState(name, value) {
1056310662 command_1.issueCommand('save-state', { name }, value);
1056410663}
0 commit comments