Skip to content

Commit 5ebf00e

Browse files
committed
Update @actions/core to 1.10.0
1 parent 3de2653 commit 5ebf00e

File tree

3 files changed

+44
-29
lines changed

3 files changed

+44
-29
lines changed

dist/index.js

+36-21
Original file line numberDiff line numberDiff line change
@@ -2484,7 +2484,6 @@ const file_command_1 = __nccwpck_require__(717);
24842484
const utils_1 = __nccwpck_require__(5278);
24852485
const os = __importStar(__nccwpck_require__(2087));
24862486
const path = __importStar(__nccwpck_require__(5622));
2487-
const uuid_1 = __nccwpck_require__(5840);
24882487
const oidc_utils_1 = __nccwpck_require__(8041);
24892488
/**
24902489
* The code to exit an action
@@ -2514,20 +2513,9 @@ function exportVariable(name, val) {
25142513
process.env[name] = convertedVal;
25152514
const filePath = process.env['GITHUB_ENV'] || '';
25162515
if (filePath) {
2517-
const delimiter = `ghadelimiter_${uuid_1.v4()}`;
2518-
// These should realistically never happen, but just in case someone finds a way to exploit uuid generation let's not allow keys or values that contain the delimiter.
2519-
if (name.includes(delimiter)) {
2520-
throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);
2521-
}
2522-
if (convertedVal.includes(delimiter)) {
2523-
throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);
2524-
}
2525-
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
2526-
file_command_1.issueCommand('ENV', commandValue);
2527-
}
2528-
else {
2529-
command_1.issueCommand('set-env', { name }, convertedVal);
2516+
return file_command_1.issueFileCommand('ENV', file_command_1.prepareKeyValueMessage(name, val));
25302517
}
2518+
command_1.issueCommand('set-env', { name }, convertedVal);
25312519
}
25322520
exports.exportVariable = exportVariable;
25332521
/**
@@ -2545,7 +2533,7 @@ exports.setSecret = setSecret;
25452533
function addPath(inputPath) {
25462534
const filePath = process.env['GITHUB_PATH'] || '';
25472535
if (filePath) {
2548-
file_command_1.issueCommand('PATH', inputPath);
2536+
file_command_1.issueFileCommand('PATH', inputPath);
25492537
}
25502538
else {
25512539
command_1.issueCommand('add-path', {}, inputPath);
@@ -2585,7 +2573,10 @@ function getMultilineInput(name, options) {
25852573
const inputs = getInput(name, options)
25862574
.split('\n')
25872575
.filter(x => x !== '');
2588-
return inputs;
2576+
if (options && options.trimWhitespace === false) {
2577+
return inputs;
2578+
}
2579+
return inputs.map(input => input.trim());
25892580
}
25902581
exports.getMultilineInput = getMultilineInput;
25912582
/**
@@ -2618,8 +2609,12 @@ exports.getBooleanInput = getBooleanInput;
26182609
*/
26192610
// eslint-disable-next-line @typescript-eslint/no-explicit-any
26202611
function setOutput(name, value) {
2612+
const filePath = process.env['GITHUB_OUTPUT'] || '';
2613+
if (filePath) {
2614+
return file_command_1.issueFileCommand('OUTPUT', file_command_1.prepareKeyValueMessage(name, value));
2615+
}
26212616
process.stdout.write(os.EOL);
2622-
command_1.issueCommand('set-output', { name }, value);
2617+
command_1.issueCommand('set-output', { name }, utils_1.toCommandValue(value));
26232618
}
26242619
exports.setOutput = setOutput;
26252620
/**
@@ -2748,7 +2743,11 @@ exports.group = group;
27482743
*/
27492744
// eslint-disable-next-line @typescript-eslint/no-explicit-any
27502745
function saveState(name, value) {
2751-
command_1.issueCommand('save-state', { name }, value);
2746+
const filePath = process.env['GITHUB_STATE'] || '';
2747+
if (filePath) {
2748+
return file_command_1.issueFileCommand('STATE', file_command_1.prepareKeyValueMessage(name, value));
2749+
}
2750+
command_1.issueCommand('save-state', { name }, utils_1.toCommandValue(value));
27522751
}
27532752
exports.saveState = saveState;
27542753
/**
@@ -2814,13 +2813,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
28142813
return result;
28152814
};
28162815
Object.defineProperty(exports, "__esModule", ({ value: true }));
2817-
exports.issueCommand = void 0;
2816+
exports.prepareKeyValueMessage = exports.issueFileCommand = void 0;
28182817
// We use any as a valid input type
28192818
/* eslint-disable @typescript-eslint/no-explicit-any */
28202819
const fs = __importStar(__nccwpck_require__(5747));
28212820
const os = __importStar(__nccwpck_require__(2087));
2821+
const uuid_1 = __nccwpck_require__(5840);
28222822
const utils_1 = __nccwpck_require__(5278);
2823-
function issueCommand(command, message) {
2823+
function issueFileCommand(command, message) {
28242824
const filePath = process.env[`GITHUB_${command}`];
28252825
if (!filePath) {
28262826
throw new Error(`Unable to find environment variable for file command ${command}`);
@@ -2832,7 +2832,22 @@ function issueCommand(command, message) {
28322832
encoding: 'utf8'
28332833
});
28342834
}
2835-
exports.issueCommand = issueCommand;
2835+
exports.issueFileCommand = issueFileCommand;
2836+
function prepareKeyValueMessage(key, value) {
2837+
const delimiter = `ghadelimiter_${uuid_1.v4()}`;
2838+
const convertedValue = utils_1.toCommandValue(value);
2839+
// These should realistically never happen, but just in case someone finds a
2840+
// way to exploit uuid generation let's not allow keys or values that contain
2841+
// the delimiter.
2842+
if (key.includes(delimiter)) {
2843+
throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);
2844+
}
2845+
if (convertedValue.includes(delimiter)) {
2846+
throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);
2847+
}
2848+
return `${key}<<${delimiter}${os.EOL}${convertedValue}${os.EOL}${delimiter}`;
2849+
}
2850+
exports.prepareKeyValueMessage = prepareKeyValueMessage;
28362851
//# sourceMappingURL=file-command.js.map
28372852

28382853
/***/ }),

package-lock.json

+7-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"author": "GitHub",
3939
"license": "MIT",
4040
"dependencies": {
41-
"@actions/core": "^1.2.6",
41+
"@actions/core": "^1.10.0",
4242
"@actions/github": "^5.0.1",
4343
"lodash.deburr": "^4.1.0",
4444
"semver": "^7.3.5"

0 commit comments

Comments
 (0)