Skip to content

Commit baaeda8

Browse files
authored
Merge pull request #545 from arduino/dependabot/npm_and_yarn/actions/core-1.10.0
build(deps): bump @actions/core from 1.9.1 to 1.10.0
2 parents 5884c3f + b19bffa commit baaeda8

File tree

4 files changed

+45
-30
lines changed

4 files changed

+45
-30
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: "@actions/core"
3-
version: 1.9.1
3+
version: 1.10.0
44
type: npm
55
summary: Actions core lib
66
homepage: https://github.com/actions/toolkit/tree/main/packages/core

dist/index.js

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,6 @@ const file_command_1 = __nccwpck_require__(717);
419419
const utils_1 = __nccwpck_require__(5278);
420420
const os = __importStar(__nccwpck_require__(2037));
421421
const path = __importStar(__nccwpck_require__(1017));
422-
const uuid_1 = __nccwpck_require__(8974);
423422
const oidc_utils_1 = __nccwpck_require__(8041);
424423
/**
425424
* The code to exit an action
@@ -449,20 +448,9 @@ function exportVariable(name, val) {
449448
process.env[name] = convertedVal;
450449
const filePath = process.env['GITHUB_ENV'] || '';
451450
if (filePath) {
452-
const delimiter = `ghadelimiter_${uuid_1.v4()}`;
453-
// 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.
454-
if (name.includes(delimiter)) {
455-
throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);
456-
}
457-
if (convertedVal.includes(delimiter)) {
458-
throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);
459-
}
460-
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
461-
file_command_1.issueCommand('ENV', commandValue);
462-
}
463-
else {
464-
command_1.issueCommand('set-env', { name }, convertedVal);
451+
return file_command_1.issueFileCommand('ENV', file_command_1.prepareKeyValueMessage(name, val));
465452
}
453+
command_1.issueCommand('set-env', { name }, convertedVal);
466454
}
467455
exports.exportVariable = exportVariable;
468456
/**
@@ -480,7 +468,7 @@ exports.setSecret = setSecret;
480468
function addPath(inputPath) {
481469
const filePath = process.env['GITHUB_PATH'] || '';
482470
if (filePath) {
483-
file_command_1.issueCommand('PATH', inputPath);
471+
file_command_1.issueFileCommand('PATH', inputPath);
484472
}
485473
else {
486474
command_1.issueCommand('add-path', {}, inputPath);
@@ -520,7 +508,10 @@ function getMultilineInput(name, options) {
520508
const inputs = getInput(name, options)
521509
.split('\n')
522510
.filter(x => x !== '');
523-
return inputs;
511+
if (options && options.trimWhitespace === false) {
512+
return inputs;
513+
}
514+
return inputs.map(input => input.trim());
524515
}
525516
exports.getMultilineInput = getMultilineInput;
526517
/**
@@ -553,8 +544,12 @@ exports.getBooleanInput = getBooleanInput;
553544
*/
554545
// eslint-disable-next-line @typescript-eslint/no-explicit-any
555546
function setOutput(name, value) {
547+
const filePath = process.env['GITHUB_OUTPUT'] || '';
548+
if (filePath) {
549+
return file_command_1.issueFileCommand('OUTPUT', file_command_1.prepareKeyValueMessage(name, value));
550+
}
556551
process.stdout.write(os.EOL);
557-
command_1.issueCommand('set-output', { name }, value);
552+
command_1.issueCommand('set-output', { name }, utils_1.toCommandValue(value));
558553
}
559554
exports.setOutput = setOutput;
560555
/**
@@ -683,7 +678,11 @@ exports.group = group;
683678
*/
684679
// eslint-disable-next-line @typescript-eslint/no-explicit-any
685680
function saveState(name, value) {
686-
command_1.issueCommand('save-state', { name }, value);
681+
const filePath = process.env['GITHUB_STATE'] || '';
682+
if (filePath) {
683+
return file_command_1.issueFileCommand('STATE', file_command_1.prepareKeyValueMessage(name, value));
684+
}
685+
command_1.issueCommand('save-state', { name }, utils_1.toCommandValue(value));
687686
}
688687
exports.saveState = saveState;
689688
/**
@@ -749,13 +748,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
749748
return result;
750749
};
751750
Object.defineProperty(exports, "__esModule", ({ value: true }));
752-
exports.issueCommand = void 0;
751+
exports.prepareKeyValueMessage = exports.issueFileCommand = void 0;
753752
// We use any as a valid input type
754753
/* eslint-disable @typescript-eslint/no-explicit-any */
755754
const fs = __importStar(__nccwpck_require__(7147));
756755
const os = __importStar(__nccwpck_require__(2037));
756+
const uuid_1 = __nccwpck_require__(8974);
757757
const utils_1 = __nccwpck_require__(5278);
758-
function issueCommand(command, message) {
758+
function issueFileCommand(command, message) {
759759
const filePath = process.env[`GITHUB_${command}`];
760760
if (!filePath) {
761761
throw new Error(`Unable to find environment variable for file command ${command}`);
@@ -767,7 +767,22 @@ function issueCommand(command, message) {
767767
encoding: 'utf8'
768768
});
769769
}
770-
exports.issueCommand = issueCommand;
770+
exports.issueFileCommand = issueFileCommand;
771+
function prepareKeyValueMessage(key, value) {
772+
const delimiter = `ghadelimiter_${uuid_1.v4()}`;
773+
const convertedValue = utils_1.toCommandValue(value);
774+
// These should realistically never happen, but just in case someone finds a
775+
// way to exploit uuid generation let's not allow keys or values that contain
776+
// the delimiter.
777+
if (key.includes(delimiter)) {
778+
throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);
779+
}
780+
if (convertedValue.includes(delimiter)) {
781+
throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);
782+
}
783+
return `${key}<<${delimiter}${os.EOL}${convertedValue}${os.EOL}${delimiter}`;
784+
}
785+
exports.prepareKeyValueMessage = prepareKeyValueMessage;
771786
//# sourceMappingURL=file-command.js.map
772787

773788
/***/ }),

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"author": "Arduino",
1717
"license": "GPL-3.0",
1818
"dependencies": {
19-
"@actions/core": "^1.9.1",
19+
"@actions/core": "^1.10.0",
2020
"@actions/tool-cache": "^2.0.1",
2121
"semver": "^7.3.7",
2222
"typed-rest-client": "^1.8.9"

0 commit comments

Comments
 (0)