@@ -1408,6 +1408,32 @@ function getServerUrl() {
1408
1408
exports.getServerUrl = getServerUrl;
1409
1409
1410
1410
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
+
1411
1437
/***/ }),
1412
1438
1413
1439
/***/ 87:
@@ -1417,6 +1443,42 @@ module.exports = require("os");
1417
1443
1418
1444
/***/ }),
1419
1445
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
+
1420
1482
/***/ 118:
1421
1483
/***/ (function(module, __unusedexports, __webpack_require__) {
1422
1484
@@ -7484,17 +7546,25 @@ function octokitValidate(octokit) {
7484
7546
7485
7547
"use strict";
7486
7548
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
+ };
7487
7556
Object.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);
7489
7559
/**
7490
7560
* Commands
7491
7561
*
7492
7562
* Command Format:
7493
- * ##[ name key=value; key=value] message
7563
+ * :: name key=value, key=value:: message
7494
7564
*
7495
7565
* 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
7498
7568
*/
7499
7569
function issueCommand(command, properties, message) {
7500
7570
const cmd = new Command(command, properties, message);
@@ -7519,34 +7589,39 @@ class Command {
7519
7589
let cmdStr = CMD_STRING + this.command;
7520
7590
if (this.properties && Object.keys(this.properties).length > 0) {
7521
7591
cmdStr += ' ';
7592
+ let first = true;
7522
7593
for (const key in this.properties) {
7523
7594
if (this.properties.hasOwnProperty(key)) {
7524
7595
const val = this.properties[key];
7525
7596
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)}`;
7529
7604
}
7530
7605
}
7531
7606
}
7532
7607
}
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)}`;
7538
7609
return cmdStr;
7539
7610
}
7540
7611
}
7541
7612
function 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');
7543
7617
}
7544
- function escape(s) {
7545
- return s
7618
+ function escapeProperty(s) {
7619
+ return utils_1.toCommandValue(s)
7620
+ .replace(/%/g, '%25')
7546
7621
.replace(/\r/g, '%0D')
7547
7622
.replace(/\n/g, '%0A')
7548
- .replace(/] /g, '%5D ')
7549
- .replace(/; /g, '%3B ');
7623
+ .replace(/: /g, '%3A ')
7624
+ .replace(/, /g, '%2C ');
7550
7625
}
7551
7626
//# sourceMappingURL=command.js.map
7552
7627
@@ -9802,10 +9877,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9802
9877
step((generator = generator.apply(thisArg, _arguments || [])).next());
9803
9878
});
9804
9879
};
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
+ };
9805
9887
Object.defineProperty(exports, "__esModule", { value: true });
9806
9888
const 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));
9809
9893
/**
9810
9894
* The code to exit an action
9811
9895
*/
@@ -9826,11 +9910,21 @@ var ExitCode;
9826
9910
/**
9827
9911
* Sets env variable for this action and future actions in the job
9828
9912
* @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
9830
9914
*/
9915
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
9831
9916
function 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
+ }
9834
9928
}
9835
9929
exports.exportVariable = exportVariable;
9836
9930
/**
@@ -9846,7 +9940,13 @@ exports.setSecret = setSecret;
9846
9940
* @param inputPath
9847
9941
*/
9848
9942
function 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
+ }
9850
9950
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
9851
9951
}
9852
9952
exports.addPath = addPath;
@@ -9869,12 +9969,22 @@ exports.getInput = getInput;
9869
9969
* Sets the value of an output.
9870
9970
*
9871
9971
* @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
9873
9973
*/
9974
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
9874
9975
function setOutput(name, value) {
9875
9976
command_1.issueCommand('set-output', { name }, value);
9876
9977
}
9877
9978
exports.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;
9878
9988
//-----------------------------------------------------------------------
9879
9989
// Results
9880
9990
//-----------------------------------------------------------------------
@@ -9891,6 +10001,13 @@ exports.setFailed = setFailed;
9891
10001
//-----------------------------------------------------------------------
9892
10002
// Logging Commands
9893
10003
//-----------------------------------------------------------------------
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;
9894
10011
/**
9895
10012
* Writes debug message to user log
9896
10013
* @param message debug message
@@ -9901,18 +10018,18 @@ function debug(message) {
9901
10018
exports.debug = debug;
9902
10019
/**
9903
10020
* Adds an error issue
9904
- * @param message error issue message
10021
+ * @param message error issue message. Errors will be converted to string via toString()
9905
10022
*/
9906
10023
function error(message) {
9907
- command_1.issue('error', message);
10024
+ command_1.issue('error', message instanceof Error ? message.toString() : message );
9908
10025
}
9909
10026
exports.error = error;
9910
10027
/**
9911
10028
* Adds an warning issue
9912
- * @param message warning issue message
10029
+ * @param message warning issue message. Errors will be converted to string via toString()
9913
10030
*/
9914
10031
function warning(message) {
9915
- command_1.issue('warning', message);
10032
+ command_1.issue('warning', message instanceof Error ? message.toString() : message );
9916
10033
}
9917
10034
exports.warning = warning;
9918
10035
/**
@@ -9963,6 +10080,30 @@ function group(name, fn) {
9963
10080
});
9964
10081
}
9965
10082
exports.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;
9966
10107
//# sourceMappingURL=core.js.map
9967
10108
9968
10109
/***/ }),
0 commit comments