@@ -1408,6 +1408,32 @@ function getServerUrl() {
14081408exports.getServerUrl = getServerUrl;
14091409
14101410
1411+ /***/ }),
1412+
1413+ /***/ 82:
1414+ /***/ (function(__unusedmodule, exports) {
1415+
1416+ "use strict";
1417+
1418+ // We use any as a valid input type
1419+ /* eslint-disable @typescript-eslint/no-explicit-any */
1420+ Object.defineProperty(exports, "__esModule", { value: true });
1421+ /**
1422+ * Sanitizes an input into a string so it can be passed into issueCommand safely
1423+ * @param input input to sanitize into a string
1424+ */
1425+ function toCommandValue(input) {
1426+ if (input === null || input === undefined) {
1427+ return '';
1428+ }
1429+ else if (typeof input === 'string' || input instanceof String) {
1430+ return input;
1431+ }
1432+ return JSON.stringify(input);
1433+ }
1434+ exports.toCommandValue = toCommandValue;
1435+ //# sourceMappingURL=utils.js.map
1436+
14111437/***/ }),
14121438
14131439/***/ 87:
@@ -1417,6 +1443,42 @@ module.exports = require("os");
14171443
14181444/***/ }),
14191445
1446+ /***/ 102:
1447+ /***/ (function(__unusedmodule, exports, __webpack_require__) {
1448+
1449+ "use strict";
1450+
1451+ // For internal use, subject to change.
1452+ var __importStar = (this && this.__importStar) || function (mod) {
1453+ if (mod && mod.__esModule) return mod;
1454+ var result = {};
1455+ if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
1456+ result["default"] = mod;
1457+ return result;
1458+ };
1459+ Object.defineProperty(exports, "__esModule", { value: true });
1460+ // We use any as a valid input type
1461+ /* eslint-disable @typescript-eslint/no-explicit-any */
1462+ const fs = __importStar(__webpack_require__(747));
1463+ const os = __importStar(__webpack_require__(87));
1464+ const utils_1 = __webpack_require__(82);
1465+ function issueCommand(command, message) {
1466+ const filePath = process.env[`GITHUB_${command}`];
1467+ if (!filePath) {
1468+ throw new Error(`Unable to find environment variable for file command ${command}`);
1469+ }
1470+ if (!fs.existsSync(filePath)) {
1471+ throw new Error(`Missing file at path: ${filePath}`);
1472+ }
1473+ fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {
1474+ encoding: 'utf8'
1475+ });
1476+ }
1477+ exports.issueCommand = issueCommand;
1478+ //# sourceMappingURL=file-command.js.map
1479+
1480+ /***/ }),
1481+
14201482/***/ 118:
14211483/***/ (function(module, __unusedexports, __webpack_require__) {
14221484
@@ -7484,17 +7546,25 @@ function octokitValidate(octokit) {
74847546
74857547"use strict";
74867548
7549+ var __importStar = (this && this.__importStar) || function (mod) {
7550+ if (mod && mod.__esModule) return mod;
7551+ var result = {};
7552+ if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
7553+ result["default"] = mod;
7554+ return result;
7555+ };
74877556Object.defineProperty(exports, "__esModule", { value: true });
7488- const os = __webpack_require__(87);
7557+ const os = __importStar(__webpack_require__(87));
7558+ const utils_1 = __webpack_require__(82);
74897559/**
74907560 * Commands
74917561 *
74927562 * Command Format:
7493- * ##[ name key=value; key=value] message
7563+ * :: name key=value, key=value:: message
74947564 *
74957565 * Examples:
7496- * ##[ warning] This is the user warning message
7497- * ##[ set-secret name=mypassword]definitelyNotAPassword!
7566+ * :: warning:: This is the message
7567+ * :: set-env name=MY_VAR::some value
74987568 */
74997569function issueCommand(command, properties, message) {
75007570 const cmd = new Command(command, properties, message);
@@ -7519,34 +7589,39 @@ class Command {
75197589 let cmdStr = CMD_STRING + this.command;
75207590 if (this.properties && Object.keys(this.properties).length > 0) {
75217591 cmdStr += ' ';
7592+ let first = true;
75227593 for (const key in this.properties) {
75237594 if (this.properties.hasOwnProperty(key)) {
75247595 const val = this.properties[key];
75257596 if (val) {
7526- // safely append the val - avoid blowing up when attempting to
7527- // call .replace() if message is not a string for some reason
7528- cmdStr += `${key}=${escape(`${val || ''}`)},`;
7597+ if (first) {
7598+ first = false;
7599+ }
7600+ else {
7601+ cmdStr += ',';
7602+ }
7603+ cmdStr += `${key}=${escapeProperty(val)}`;
75297604 }
75307605 }
75317606 }
75327607 }
7533- cmdStr += CMD_STRING;
7534- // safely append the message - avoid blowing up when attempting to
7535- // call .replace() if message is not a string for some reason
7536- const message = `${this.message || ''}`;
7537- cmdStr += escapeData(message);
7608+ cmdStr += `${CMD_STRING}${escapeData(this.message)}`;
75387609 return cmdStr;
75397610 }
75407611}
75417612function escapeData(s) {
7542- return s.replace(/\r/g, '%0D').replace(/\n/g, '%0A');
7613+ return utils_1.toCommandValue(s)
7614+ .replace(/%/g, '%25')
7615+ .replace(/\r/g, '%0D')
7616+ .replace(/\n/g, '%0A');
75437617}
7544- function escape(s) {
7545- return s
7618+ function escapeProperty(s) {
7619+ return utils_1.toCommandValue(s)
7620+ .replace(/%/g, '%25')
75467621 .replace(/\r/g, '%0D')
75477622 .replace(/\n/g, '%0A')
7548- .replace(/] /g, '%5D ')
7549- .replace(/; /g, '%3B ');
7623+ .replace(/: /g, '%3A ')
7624+ .replace(/, /g, '%2C ');
75507625}
75517626//# sourceMappingURL=command.js.map
75527627
@@ -9802,10 +9877,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
98029877 step((generator = generator.apply(thisArg, _arguments || [])).next());
98039878 });
98049879};
9880+ var __importStar = (this && this.__importStar) || function (mod) {
9881+ if (mod && mod.__esModule) return mod;
9882+ var result = {};
9883+ if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
9884+ result["default"] = mod;
9885+ return result;
9886+ };
98059887Object.defineProperty(exports, "__esModule", { value: true });
98069888const command_1 = __webpack_require__(431);
9807- const os = __webpack_require__(87);
9808- const path = __webpack_require__(622);
9889+ const file_command_1 = __webpack_require__(102);
9890+ const utils_1 = __webpack_require__(82);
9891+ const os = __importStar(__webpack_require__(87));
9892+ const path = __importStar(__webpack_require__(622));
98099893/**
98109894 * The code to exit an action
98119895 */
@@ -9826,11 +9910,21 @@ var ExitCode;
98269910/**
98279911 * Sets env variable for this action and future actions in the job
98289912 * @param name the name of the variable to set
9829- * @param val the value of the variable
9913+ * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
98309914 */
9915+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
98319916function exportVariable(name, val) {
9832- process.env[name] = val;
9833- command_1.issueCommand('set-env', { name }, val);
9917+ const convertedVal = utils_1.toCommandValue(val);
9918+ process.env[name] = convertedVal;
9919+ const filePath = process.env['GITHUB_ENV'] || '';
9920+ if (filePath) {
9921+ const delimiter = '_GitHubActionsFileCommandDelimeter_';
9922+ const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
9923+ file_command_1.issueCommand('ENV', commandValue);
9924+ }
9925+ else {
9926+ command_1.issueCommand('set-env', { name }, convertedVal);
9927+ }
98349928}
98359929exports.exportVariable = exportVariable;
98369930/**
@@ -9846,7 +9940,13 @@ exports.setSecret = setSecret;
98469940 * @param inputPath
98479941 */
98489942function addPath(inputPath) {
9849- command_1.issueCommand('add-path', {}, inputPath);
9943+ const filePath = process.env['GITHUB_PATH'] || '';
9944+ if (filePath) {
9945+ file_command_1.issueCommand('PATH', inputPath);
9946+ }
9947+ else {
9948+ command_1.issueCommand('add-path', {}, inputPath);
9949+ }
98509950 process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
98519951}
98529952exports.addPath = addPath;
@@ -9869,12 +9969,22 @@ exports.getInput = getInput;
98699969 * Sets the value of an output.
98709970 *
98719971 * @param name name of the output to set
9872- * @param value value to store
9972+ * @param value value to store. Non-string values will be converted to a string via JSON.stringify
98739973 */
9974+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
98749975function setOutput(name, value) {
98759976 command_1.issueCommand('set-output', { name }, value);
98769977}
98779978exports.setOutput = setOutput;
9979+ /**
9980+ * Enables or disables the echoing of commands into stdout for the rest of the step.
9981+ * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
9982+ *
9983+ */
9984+ function setCommandEcho(enabled) {
9985+ command_1.issue('echo', enabled ? 'on' : 'off');
9986+ }
9987+ exports.setCommandEcho = setCommandEcho;
98789988//-----------------------------------------------------------------------
98799989// Results
98809990//-----------------------------------------------------------------------
@@ -9891,6 +10001,13 @@ exports.setFailed = setFailed;
989110001//-----------------------------------------------------------------------
989210002// Logging Commands
989310003//-----------------------------------------------------------------------
10004+ /**
10005+ * Gets whether Actions Step Debug is on or not
10006+ */
10007+ function isDebug() {
10008+ return process.env['RUNNER_DEBUG'] === '1';
10009+ }
10010+ exports.isDebug = isDebug;
989410011/**
989510012 * Writes debug message to user log
989610013 * @param message debug message
@@ -9901,18 +10018,18 @@ function debug(message) {
990110018exports.debug = debug;
990210019/**
990310020 * Adds an error issue
9904- * @param message error issue message
10021+ * @param message error issue message. Errors will be converted to string via toString()
990510022 */
990610023function error(message) {
9907- command_1.issue('error', message);
10024+ command_1.issue('error', message instanceof Error ? message.toString() : message );
990810025}
990910026exports.error = error;
991010027/**
991110028 * Adds an warning issue
9912- * @param message warning issue message
10029+ * @param message warning issue message. Errors will be converted to string via toString()
991310030 */
991410031function warning(message) {
9915- command_1.issue('warning', message);
10032+ command_1.issue('warning', message instanceof Error ? message.toString() : message );
991610033}
991710034exports.warning = warning;
991810035/**
@@ -9963,6 +10080,30 @@ function group(name, fn) {
996310080 });
996410081}
996510082exports.group = group;
10083+ //-----------------------------------------------------------------------
10084+ // Wrapper action state
10085+ //-----------------------------------------------------------------------
10086+ /**
10087+ * Saves state for current action, the state can only be retrieved by this action's post job execution.
10088+ *
10089+ * @param name name of the state to store
10090+ * @param value value to store. Non-string values will be converted to a string via JSON.stringify
10091+ */
10092+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
10093+ function saveState(name, value) {
10094+ command_1.issueCommand('save-state', { name }, value);
10095+ }
10096+ exports.saveState = saveState;
10097+ /**
10098+ * Gets the value of an state set by this action's main execution.
10099+ *
10100+ * @param name name of the state to get
10101+ * @returns string
10102+ */
10103+ function getState(name) {
10104+ return process.env[`STATE_${name}`] || '';
10105+ }
10106+ exports.getState = getState;
996610107//# sourceMappingURL=core.js.map
996710108
996810109/***/ }),
0 commit comments