Skip to content

Commit 5c75392

Browse files
authored
Merge pull request actions#444 from actions/rentziass/update-actions-core
Update @actions/core to 1.10.0
2 parents a96e5ae + d8fb392 commit 5c75392

File tree

4 files changed

+45
-30
lines changed

4 files changed

+45
-30
lines changed

.licenses/npm/@actions/core.dep.yml

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

dist/index.js

+36-21
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,6 @@ const file_command_1 = __nccwpck_require__(717);
383383
const utils_1 = __nccwpck_require__(5278);
384384
const os = __importStar(__nccwpck_require__(2037));
385385
const path = __importStar(__nccwpck_require__(1017));
386-
const uuid_1 = __nccwpck_require__(5840);
387386
const oidc_utils_1 = __nccwpck_require__(8041);
388387
/**
389388
* The code to exit an action
@@ -413,20 +412,9 @@ function exportVariable(name, val) {
413412
process.env[name] = convertedVal;
414413
const filePath = process.env['GITHUB_ENV'] || '';
415414
if (filePath) {
416-
const delimiter = `ghadelimiter_${uuid_1.v4()}`;
417-
// 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.
418-
if (name.includes(delimiter)) {
419-
throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);
420-
}
421-
if (convertedVal.includes(delimiter)) {
422-
throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);
423-
}
424-
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
425-
file_command_1.issueCommand('ENV', commandValue);
426-
}
427-
else {
428-
command_1.issueCommand('set-env', { name }, convertedVal);
415+
return file_command_1.issueFileCommand('ENV', file_command_1.prepareKeyValueMessage(name, val));
429416
}
417+
command_1.issueCommand('set-env', { name }, convertedVal);
430418
}
431419
exports.exportVariable = exportVariable;
432420
/**
@@ -444,7 +432,7 @@ exports.setSecret = setSecret;
444432
function addPath(inputPath) {
445433
const filePath = process.env['GITHUB_PATH'] || '';
446434
if (filePath) {
447-
file_command_1.issueCommand('PATH', inputPath);
435+
file_command_1.issueFileCommand('PATH', inputPath);
448436
}
449437
else {
450438
command_1.issueCommand('add-path', {}, inputPath);
@@ -484,7 +472,10 @@ function getMultilineInput(name, options) {
484472
const inputs = getInput(name, options)
485473
.split('\n')
486474
.filter(x => x !== '');
487-
return inputs;
475+
if (options && options.trimWhitespace === false) {
476+
return inputs;
477+
}
478+
return inputs.map(input => input.trim());
488479
}
489480
exports.getMultilineInput = getMultilineInput;
490481
/**
@@ -517,8 +508,12 @@ exports.getBooleanInput = getBooleanInput;
517508
*/
518509
// eslint-disable-next-line @typescript-eslint/no-explicit-any
519510
function setOutput(name, value) {
511+
const filePath = process.env['GITHUB_OUTPUT'] || '';
512+
if (filePath) {
513+
return file_command_1.issueFileCommand('OUTPUT', file_command_1.prepareKeyValueMessage(name, value));
514+
}
520515
process.stdout.write(os.EOL);
521-
command_1.issueCommand('set-output', { name }, value);
516+
command_1.issueCommand('set-output', { name }, utils_1.toCommandValue(value));
522517
}
523518
exports.setOutput = setOutput;
524519
/**
@@ -647,7 +642,11 @@ exports.group = group;
647642
*/
648643
// eslint-disable-next-line @typescript-eslint/no-explicit-any
649644
function saveState(name, value) {
650-
command_1.issueCommand('save-state', { name }, value);
645+
const filePath = process.env['GITHUB_STATE'] || '';
646+
if (filePath) {
647+
return file_command_1.issueFileCommand('STATE', file_command_1.prepareKeyValueMessage(name, value));
648+
}
649+
command_1.issueCommand('save-state', { name }, utils_1.toCommandValue(value));
651650
}
652651
exports.saveState = saveState;
653652
/**
@@ -713,13 +712,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
713712
return result;
714713
};
715714
Object.defineProperty(exports, "__esModule", ({ value: true }));
716-
exports.issueCommand = void 0;
715+
exports.prepareKeyValueMessage = exports.issueFileCommand = void 0;
717716
// We use any as a valid input type
718717
/* eslint-disable @typescript-eslint/no-explicit-any */
719718
const fs = __importStar(__nccwpck_require__(7147));
720719
const os = __importStar(__nccwpck_require__(2037));
720+
const uuid_1 = __nccwpck_require__(5840);
721721
const utils_1 = __nccwpck_require__(5278);
722-
function issueCommand(command, message) {
722+
function issueFileCommand(command, message) {
723723
const filePath = process.env[`GITHUB_${command}`];
724724
if (!filePath) {
725725
throw new Error(`Unable to find environment variable for file command ${command}`);
@@ -731,7 +731,22 @@ function issueCommand(command, message) {
731731
encoding: 'utf8'
732732
});
733733
}
734-
exports.issueCommand = issueCommand;
734+
exports.issueFileCommand = issueFileCommand;
735+
function prepareKeyValueMessage(key, value) {
736+
const delimiter = `ghadelimiter_${uuid_1.v4()}`;
737+
const convertedValue = utils_1.toCommandValue(value);
738+
// These should realistically never happen, but just in case someone finds a
739+
// way to exploit uuid generation let's not allow keys or values that contain
740+
// the delimiter.
741+
if (key.includes(delimiter)) {
742+
throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);
743+
}
744+
if (convertedValue.includes(delimiter)) {
745+
throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);
746+
}
747+
return `${key}<<${delimiter}${os.EOL}${convertedValue}${os.EOL}${delimiter}`;
748+
}
749+
exports.prepareKeyValueMessage = prepareKeyValueMessage;
735750
//# sourceMappingURL=file-command.js.map
736751

737752
/***/ }),

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
@@ -22,7 +22,7 @@
2222
"author": "GitHub",
2323
"license": "MIT",
2424
"dependencies": {
25-
"@actions/core": "^1.9.1",
25+
"@actions/core": "^1.10.0",
2626
"@actions/github": "^5.0.0",
2727
"js-yaml": "^4.1.0",
2828
"minimatch": "^3.0.4"

0 commit comments

Comments
 (0)