@@ -3028,6 +3028,32 @@ const windowsRelease = release => {
3028
3028
module.exports = windowsRelease;
3029
3029
3030
3030
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
+
3031
3057
/***/ }),
3032
3058
3033
3059
/***/ 87:
@@ -3037,6 +3063,42 @@ module.exports = require("os");
3037
3063
3038
3064
/***/ }),
3039
3065
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
+
3040
3102
/***/ 108:
3041
3103
/***/ (function(module, __unusedexports, __webpack_require__) {
3042
3104
@@ -8406,6 +8468,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
8406
8468
};
8407
8469
Object.defineProperty(exports, "__esModule", { value: true });
8408
8470
const os = __importStar(__webpack_require__(87));
8471
+ const utils_1 = __webpack_require__(82);
8409
8472
/**
8410
8473
* Commands
8411
8474
*
@@ -8460,13 +8523,13 @@ class Command {
8460
8523
}
8461
8524
}
8462
8525
function escapeData(s) {
8463
- return (s || '' )
8526
+ return utils_1.toCommandValue(s )
8464
8527
.replace(/%/g, '%25')
8465
8528
.replace(/\r/g, '%0D')
8466
8529
.replace(/\n/g, '%0A');
8467
8530
}
8468
8531
function escapeProperty(s) {
8469
- return (s || '' )
8532
+ return utils_1.toCommandValue(s )
8470
8533
.replace(/%/g, '%25')
8471
8534
.replace(/\r/g, '%0D')
8472
8535
.replace(/\n/g, '%0A')
@@ -10391,6 +10454,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
10391
10454
};
10392
10455
Object.defineProperty(exports, "__esModule", { value: true });
10393
10456
const command_1 = __webpack_require__(431);
10457
+ const file_command_1 = __webpack_require__(102);
10458
+ const utils_1 = __webpack_require__(82);
10394
10459
const os = __importStar(__webpack_require__(87));
10395
10460
const path = __importStar(__webpack_require__(622));
10396
10461
/**
@@ -10413,11 +10478,21 @@ var ExitCode;
10413
10478
/**
10414
10479
* Sets env variable for this action and future actions in the job
10415
10480
* @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
10417
10482
*/
10483
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
10418
10484
function 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
+ }
10421
10496
}
10422
10497
exports.exportVariable = exportVariable;
10423
10498
/**
@@ -10433,7 +10508,13 @@ exports.setSecret = setSecret;
10433
10508
* @param inputPath
10434
10509
*/
10435
10510
function 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
+ }
10437
10518
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
10438
10519
}
10439
10520
exports.addPath = addPath;
@@ -10456,12 +10537,22 @@ exports.getInput = getInput;
10456
10537
* Sets the value of an output.
10457
10538
*
10458
10539
* @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
10460
10541
*/
10542
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
10461
10543
function setOutput(name, value) {
10462
10544
command_1.issueCommand('set-output', { name }, value);
10463
10545
}
10464
10546
exports.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;
10465
10556
//-----------------------------------------------------------------------
10466
10557
// Results
10467
10558
//-----------------------------------------------------------------------
@@ -10478,6 +10569,13 @@ exports.setFailed = setFailed;
10478
10569
//-----------------------------------------------------------------------
10479
10570
// Logging Commands
10480
10571
//-----------------------------------------------------------------------
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;
10481
10579
/**
10482
10580
* Writes debug message to user log
10483
10581
* @param message debug message
@@ -10488,18 +10586,18 @@ function debug(message) {
10488
10586
exports.debug = debug;
10489
10587
/**
10490
10588
* Adds an error issue
10491
- * @param message error issue message
10589
+ * @param message error issue message. Errors will be converted to string via toString()
10492
10590
*/
10493
10591
function error(message) {
10494
- command_1.issue('error', message);
10592
+ command_1.issue('error', message instanceof Error ? message.toString() : message );
10495
10593
}
10496
10594
exports.error = error;
10497
10595
/**
10498
10596
* Adds an warning issue
10499
- * @param message warning issue message
10597
+ * @param message warning issue message. Errors will be converted to string via toString()
10500
10598
*/
10501
10599
function warning(message) {
10502
- command_1.issue('warning', message);
10600
+ command_1.issue('warning', message instanceof Error ? message.toString() : message );
10503
10601
}
10504
10602
exports.warning = warning;
10505
10603
/**
@@ -10557,8 +10655,9 @@ exports.group = group;
10557
10655
* Saves state for current action, the state can only be retrieved by this action's post job execution.
10558
10656
*
10559
10657
* @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
10561
10659
*/
10660
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
10562
10661
function saveState(name, value) {
10563
10662
command_1.issueCommand('save-state', { name }, value);
10564
10663
}
0 commit comments