@@ -2883,6 +2883,32 @@ const windowsRelease = release => {
2883
2883
module.exports = windowsRelease;
2884
2884
2885
2885
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
+
2886
2912
/***/ }),
2887
2913
2888
2914
/***/ 87:
@@ -2892,6 +2918,42 @@ module.exports = require("os");
2892
2918
2893
2919
/***/ }),
2894
2920
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
+
2895
2957
/***/ 118:
2896
2958
/***/ (function(module, __unusedexports, __webpack_require__) {
2897
2959
@@ -7596,6 +7658,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
7596
7658
};
7597
7659
Object.defineProperty(exports, "__esModule", { value: true });
7598
7660
const os = __importStar(__webpack_require__(87));
7661
+ const utils_1 = __webpack_require__(82);
7599
7662
/**
7600
7663
* Commands
7601
7664
*
@@ -7650,13 +7713,13 @@ class Command {
7650
7713
}
7651
7714
}
7652
7715
function escapeData(s) {
7653
- return (s || '' )
7716
+ return utils_1.toCommandValue(s )
7654
7717
.replace(/%/g, '%25')
7655
7718
.replace(/\r/g, '%0D')
7656
7719
.replace(/\n/g, '%0A');
7657
7720
}
7658
7721
function escapeProperty(s) {
7659
- return (s || '' )
7722
+ return utils_1.toCommandValue(s )
7660
7723
.replace(/%/g, '%25')
7661
7724
.replace(/\r/g, '%0D')
7662
7725
.replace(/\n/g, '%0A')
@@ -9581,6 +9644,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
9581
9644
};
9582
9645
Object.defineProperty(exports, "__esModule", { value: true });
9583
9646
const command_1 = __webpack_require__(431);
9647
+ const file_command_1 = __webpack_require__(102);
9648
+ const utils_1 = __webpack_require__(82);
9584
9649
const os = __importStar(__webpack_require__(87));
9585
9650
const path = __importStar(__webpack_require__(622));
9586
9651
/**
@@ -9603,11 +9668,21 @@ var ExitCode;
9603
9668
/**
9604
9669
* Sets env variable for this action and future actions in the job
9605
9670
* @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
9607
9672
*/
9673
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
9608
9674
function 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
+ }
9611
9686
}
9612
9687
exports.exportVariable = exportVariable;
9613
9688
/**
@@ -9623,7 +9698,13 @@ exports.setSecret = setSecret;
9623
9698
* @param inputPath
9624
9699
*/
9625
9700
function 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
+ }
9627
9708
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
9628
9709
}
9629
9710
exports.addPath = addPath;
@@ -9646,12 +9727,22 @@ exports.getInput = getInput;
9646
9727
* Sets the value of an output.
9647
9728
*
9648
9729
* @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
9650
9731
*/
9732
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
9651
9733
function setOutput(name, value) {
9652
9734
command_1.issueCommand('set-output', { name }, value);
9653
9735
}
9654
9736
exports.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;
9655
9746
//-----------------------------------------------------------------------
9656
9747
// Results
9657
9748
//-----------------------------------------------------------------------
@@ -9668,6 +9759,13 @@ exports.setFailed = setFailed;
9668
9759
//-----------------------------------------------------------------------
9669
9760
// Logging Commands
9670
9761
//-----------------------------------------------------------------------
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;
9671
9769
/**
9672
9770
* Writes debug message to user log
9673
9771
* @param message debug message
@@ -9678,18 +9776,18 @@ function debug(message) {
9678
9776
exports.debug = debug;
9679
9777
/**
9680
9778
* Adds an error issue
9681
- * @param message error issue message
9779
+ * @param message error issue message. Errors will be converted to string via toString()
9682
9780
*/
9683
9781
function error(message) {
9684
- command_1.issue('error', message);
9782
+ command_1.issue('error', message instanceof Error ? message.toString() : message );
9685
9783
}
9686
9784
exports.error = error;
9687
9785
/**
9688
9786
* Adds an warning issue
9689
- * @param message warning issue message
9787
+ * @param message warning issue message. Errors will be converted to string via toString()
9690
9788
*/
9691
9789
function warning(message) {
9692
- command_1.issue('warning', message);
9790
+ command_1.issue('warning', message instanceof Error ? message.toString() : message );
9693
9791
}
9694
9792
exports.warning = warning;
9695
9793
/**
@@ -9747,8 +9845,9 @@ exports.group = group;
9747
9845
* Saves state for current action, the state can only be retrieved by this action's post job execution.
9748
9846
*
9749
9847
* @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
9751
9849
*/
9850
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
9752
9851
function saveState(name, value) {
9753
9852
command_1.issueCommand('save-state', { name }, value);
9754
9853
}
0 commit comments