Skip to content

Commit e489f7c

Browse files
authored
Merge pull request #175 from arduino/dependabot/npm_and_yarn/actions/core-1.10.0
Bump @actions/core from 1.9.1 to 1.10.0
2 parents ead3aaf + fdb2976 commit e489f7c

File tree

3 files changed

+44
-29
lines changed

3 files changed

+44
-29
lines changed

dist/index.js

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,6 @@ const file_command_1 = __nccwpck_require__(717);
470470
const utils_1 = __nccwpck_require__(5278);
471471
const os = __importStar(__nccwpck_require__(2037));
472472
const path = __importStar(__nccwpck_require__(1017));
473-
const uuid_1 = __nccwpck_require__(8974);
474473
const oidc_utils_1 = __nccwpck_require__(8041);
475474
/**
476475
* The code to exit an action
@@ -500,20 +499,9 @@ function exportVariable(name, val) {
500499
process.env[name] = convertedVal;
501500
const filePath = process.env['GITHUB_ENV'] || '';
502501
if (filePath) {
503-
const delimiter = `ghadelimiter_${uuid_1.v4()}`;
504-
// 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.
505-
if (name.includes(delimiter)) {
506-
throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);
507-
}
508-
if (convertedVal.includes(delimiter)) {
509-
throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);
510-
}
511-
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
512-
file_command_1.issueCommand('ENV', commandValue);
513-
}
514-
else {
515-
command_1.issueCommand('set-env', { name }, convertedVal);
502+
return file_command_1.issueFileCommand('ENV', file_command_1.prepareKeyValueMessage(name, val));
516503
}
504+
command_1.issueCommand('set-env', { name }, convertedVal);
517505
}
518506
exports.exportVariable = exportVariable;
519507
/**
@@ -531,7 +519,7 @@ exports.setSecret = setSecret;
531519
function addPath(inputPath) {
532520
const filePath = process.env['GITHUB_PATH'] || '';
533521
if (filePath) {
534-
file_command_1.issueCommand('PATH', inputPath);
522+
file_command_1.issueFileCommand('PATH', inputPath);
535523
}
536524
else {
537525
command_1.issueCommand('add-path', {}, inputPath);
@@ -571,7 +559,10 @@ function getMultilineInput(name, options) {
571559
const inputs = getInput(name, options)
572560
.split('\n')
573561
.filter(x => x !== '');
574-
return inputs;
562+
if (options && options.trimWhitespace === false) {
563+
return inputs;
564+
}
565+
return inputs.map(input => input.trim());
575566
}
576567
exports.getMultilineInput = getMultilineInput;
577568
/**
@@ -604,8 +595,12 @@ exports.getBooleanInput = getBooleanInput;
604595
*/
605596
// eslint-disable-next-line @typescript-eslint/no-explicit-any
606597
function setOutput(name, value) {
598+
const filePath = process.env['GITHUB_OUTPUT'] || '';
599+
if (filePath) {
600+
return file_command_1.issueFileCommand('OUTPUT', file_command_1.prepareKeyValueMessage(name, value));
601+
}
607602
process.stdout.write(os.EOL);
608-
command_1.issueCommand('set-output', { name }, value);
603+
command_1.issueCommand('set-output', { name }, utils_1.toCommandValue(value));
609604
}
610605
exports.setOutput = setOutput;
611606
/**
@@ -734,7 +729,11 @@ exports.group = group;
734729
*/
735730
// eslint-disable-next-line @typescript-eslint/no-explicit-any
736731
function saveState(name, value) {
737-
command_1.issueCommand('save-state', { name }, value);
732+
const filePath = process.env['GITHUB_STATE'] || '';
733+
if (filePath) {
734+
return file_command_1.issueFileCommand('STATE', file_command_1.prepareKeyValueMessage(name, value));
735+
}
736+
command_1.issueCommand('save-state', { name }, utils_1.toCommandValue(value));
738737
}
739738
exports.saveState = saveState;
740739
/**
@@ -800,13 +799,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
800799
return result;
801800
};
802801
Object.defineProperty(exports, "__esModule", ({ value: true }));
803-
exports.issueCommand = void 0;
802+
exports.prepareKeyValueMessage = exports.issueFileCommand = void 0;
804803
// We use any as a valid input type
805804
/* eslint-disable @typescript-eslint/no-explicit-any */
806805
const fs = __importStar(__nccwpck_require__(7147));
807806
const os = __importStar(__nccwpck_require__(2037));
807+
const uuid_1 = __nccwpck_require__(8974);
808808
const utils_1 = __nccwpck_require__(5278);
809-
function issueCommand(command, message) {
809+
function issueFileCommand(command, message) {
810810
const filePath = process.env[`GITHUB_${command}`];
811811
if (!filePath) {
812812
throw new Error(`Unable to find environment variable for file command ${command}`);
@@ -818,7 +818,22 @@ function issueCommand(command, message) {
818818
encoding: 'utf8'
819819
});
820820
}
821-
exports.issueCommand = issueCommand;
821+
exports.issueFileCommand = issueFileCommand;
822+
function prepareKeyValueMessage(key, value) {
823+
const delimiter = `ghadelimiter_${uuid_1.v4()}`;
824+
const convertedValue = utils_1.toCommandValue(value);
825+
// These should realistically never happen, but just in case someone finds a
826+
// way to exploit uuid generation let's not allow keys or values that contain
827+
// the delimiter.
828+
if (key.includes(delimiter)) {
829+
throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);
830+
}
831+
if (convertedValue.includes(delimiter)) {
832+
throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);
833+
}
834+
return `${key}<<${delimiter}${os.EOL}${convertedValue}${os.EOL}${delimiter}`;
835+
}
836+
exports.prepareKeyValueMessage = prepareKeyValueMessage;
822837
//# sourceMappingURL=file-command.js.map
823838

824839
/***/ }),

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
@@ -22,7 +22,7 @@
2222
"author": "Arduino",
2323
"license": "MIT",
2424
"dependencies": {
25-
"@actions/core": "^1.9.1",
25+
"@actions/core": "^1.10.0",
2626
"@actions/http-client": "^2.0.1",
2727
"@actions/tool-cache": "^2.0.1",
2828
"semver": "^7.3.7"

0 commit comments

Comments
 (0)