Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 211cb3f

Browse files
authored
Merge pull request actions#350 from actions/rentziass/core-v5
Upgrade @actions/core to 1.10.0 for v5
2 parents 9b7ebbb + ca0eeff commit 211cb3f

File tree

3 files changed

+48
-33
lines changed

3 files changed

+48
-33
lines changed

dist/index.js

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3605,7 +3605,6 @@ const file_command_1 = __webpack_require__(717);
36053605
const utils_1 = __webpack_require__(278);
36063606
const os = __importStar(__webpack_require__(87));
36073607
const path = __importStar(__webpack_require__(622));
3608-
const uuid_1 = __webpack_require__(840);
36093608
const oidc_utils_1 = __webpack_require__(41);
36103609
/**
36113610
* The code to exit an action
@@ -3635,20 +3634,9 @@ function exportVariable(name, val) {
36353634
process.env[name] = convertedVal;
36363635
const filePath = process.env['GITHUB_ENV'] || '';
36373636
if (filePath) {
3638-
const delimiter = `ghadelimiter_${uuid_1.v4()}`;
3639-
// 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.
3640-
if (name.includes(delimiter)) {
3641-
throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);
3642-
}
3643-
if (convertedVal.includes(delimiter)) {
3644-
throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);
3645-
}
3646-
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
3647-
file_command_1.issueCommand('ENV', commandValue);
3648-
}
3649-
else {
3650-
command_1.issueCommand('set-env', { name }, convertedVal);
3637+
return file_command_1.issueFileCommand('ENV', file_command_1.prepareKeyValueMessage(name, val));
36513638
}
3639+
command_1.issueCommand('set-env', { name }, convertedVal);
36523640
}
36533641
exports.exportVariable = exportVariable;
36543642
/**
@@ -3666,7 +3654,7 @@ exports.setSecret = setSecret;
36663654
function addPath(inputPath) {
36673655
const filePath = process.env['GITHUB_PATH'] || '';
36683656
if (filePath) {
3669-
file_command_1.issueCommand('PATH', inputPath);
3657+
file_command_1.issueFileCommand('PATH', inputPath);
36703658
}
36713659
else {
36723660
command_1.issueCommand('add-path', {}, inputPath);
@@ -3706,7 +3694,10 @@ function getMultilineInput(name, options) {
37063694
const inputs = getInput(name, options)
37073695
.split('\n')
37083696
.filter(x => x !== '');
3709-
return inputs;
3697+
if (options && options.trimWhitespace === false) {
3698+
return inputs;
3699+
}
3700+
return inputs.map(input => input.trim());
37103701
}
37113702
exports.getMultilineInput = getMultilineInput;
37123703
/**
@@ -3739,8 +3730,12 @@ exports.getBooleanInput = getBooleanInput;
37393730
*/
37403731
// eslint-disable-next-line @typescript-eslint/no-explicit-any
37413732
function setOutput(name, value) {
3733+
const filePath = process.env['GITHUB_OUTPUT'] || '';
3734+
if (filePath) {
3735+
return file_command_1.issueFileCommand('OUTPUT', file_command_1.prepareKeyValueMessage(name, value));
3736+
}
37423737
process.stdout.write(os.EOL);
3743-
command_1.issueCommand('set-output', { name }, value);
3738+
command_1.issueCommand('set-output', { name }, utils_1.toCommandValue(value));
37443739
}
37453740
exports.setOutput = setOutput;
37463741
/**
@@ -3869,7 +3864,11 @@ exports.group = group;
38693864
*/
38703865
// eslint-disable-next-line @typescript-eslint/no-explicit-any
38713866
function saveState(name, value) {
3872-
command_1.issueCommand('save-state', { name }, value);
3867+
const filePath = process.env['GITHUB_STATE'] || '';
3868+
if (filePath) {
3869+
return file_command_1.issueFileCommand('STATE', file_command_1.prepareKeyValueMessage(name, value));
3870+
}
3871+
command_1.issueCommand('save-state', { name }, utils_1.toCommandValue(value));
38733872
}
38743873
exports.saveState = saveState;
38753874
/**
@@ -10561,13 +10560,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
1056110560
return result;
1056210561
};
1056310562
Object.defineProperty(exports, "__esModule", { value: true });
10564-
exports.issueCommand = void 0;
10563+
exports.prepareKeyValueMessage = exports.issueFileCommand = void 0;
1056510564
// We use any as a valid input type
1056610565
/* eslint-disable @typescript-eslint/no-explicit-any */
1056710566
const fs = __importStar(__webpack_require__(747));
1056810567
const os = __importStar(__webpack_require__(87));
10568+
const uuid_1 = __webpack_require__(840);
1056910569
const utils_1 = __webpack_require__(278);
10570-
function issueCommand(command, message) {
10570+
function issueFileCommand(command, message) {
1057110571
const filePath = process.env[`GITHUB_${command}`];
1057210572
if (!filePath) {
1057310573
throw new Error(`Unable to find environment variable for file command ${command}`);
@@ -10579,7 +10579,22 @@ function issueCommand(command, message) {
1057910579
encoding: 'utf8'
1058010580
});
1058110581
}
10582-
exports.issueCommand = issueCommand;
10582+
exports.issueFileCommand = issueFileCommand;
10583+
function prepareKeyValueMessage(key, value) {
10584+
const delimiter = `ghadelimiter_${uuid_1.v4()}`;
10585+
const convertedValue = utils_1.toCommandValue(value);
10586+
// These should realistically never happen, but just in case someone finds a
10587+
// way to exploit uuid generation let's not allow keys or values that contain
10588+
// the delimiter.
10589+
if (key.includes(delimiter)) {
10590+
throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);
10591+
}
10592+
if (convertedValue.includes(delimiter)) {
10593+
throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);
10594+
}
10595+
return `${key}<<${delimiter}${os.EOL}${convertedValue}${os.EOL}${delimiter}`;
10596+
}
10597+
exports.prepareKeyValueMessage = prepareKeyValueMessage;
1058310598
//# sourceMappingURL=file-command.js.map
1058410599

1058510600
/***/ }),

package-lock.json

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

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "github-script",
33
"description": "A GitHub action for executing a simple script",
4-
"version": "5.1.0",
4+
"version": "5.2.0",
55
"author": "GitHub",
66
"license": "MIT",
77
"main": "dist/index.js",
@@ -31,7 +31,7 @@
3131
}
3232
},
3333
"dependencies": {
34-
"@actions/core": "^1.9.1",
34+
"@actions/core": "^1.10.0",
3535
"@actions/exec": "^1.1.0",
3636
"@actions/github": "^5.0.0",
3737
"@actions/glob": "^0.2.0",
@@ -54,4 +54,4 @@
5454
"ts-jest": "^27.0.5",
5555
"typescript": "^4.3.5"
5656
}
57-
}
57+
}

0 commit comments

Comments
 (0)