Skip to content

Commit 8c91899

Browse files
authored
Update @actions/core to 1.10.0 (#587)
1 parent c81d8ad commit 8c91899

File tree

6 files changed

+82
-51
lines changed

6 files changed

+82
-51
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.

__tests__/installer.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ describe('setup-node', () => {
4646
// @actions/core
4747
console.log('::stop-commands::stoptoken'); // Disable executing of runner commands when running tests in actions
4848
process.env['GITHUB_PATH'] = ''; // Stub out ENV file functionality so we can verify it writes to standard out
49+
process.env['GITHUB_OUTPUT'] = ''; // Stub out ENV file functionality so we can verify it writes to standard out
4950
inputs = {};
5051
inSpy = jest.spyOn(core, 'getInput');
5152
inSpy.mockImplementation(name => inputs[name]);

dist/cache-save/index.js

+36-21
Original file line numberDiff line numberDiff line change
@@ -3477,7 +3477,6 @@ const file_command_1 = __nccwpck_require__(717);
34773477
const utils_1 = __nccwpck_require__(5278);
34783478
const os = __importStar(__nccwpck_require__(2037));
34793479
const path = __importStar(__nccwpck_require__(1017));
3480-
const uuid_1 = __nccwpck_require__(8974);
34813480
const oidc_utils_1 = __nccwpck_require__(8041);
34823481
/**
34833482
* The code to exit an action
@@ -3507,20 +3506,9 @@ function exportVariable(name, val) {
35073506
process.env[name] = convertedVal;
35083507
const filePath = process.env['GITHUB_ENV'] || '';
35093508
if (filePath) {
3510-
const delimiter = `ghadelimiter_${uuid_1.v4()}`;
3511-
// 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.
3512-
if (name.includes(delimiter)) {
3513-
throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);
3514-
}
3515-
if (convertedVal.includes(delimiter)) {
3516-
throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);
3517-
}
3518-
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
3519-
file_command_1.issueCommand('ENV', commandValue);
3520-
}
3521-
else {
3522-
command_1.issueCommand('set-env', { name }, convertedVal);
3509+
return file_command_1.issueFileCommand('ENV', file_command_1.prepareKeyValueMessage(name, val));
35233510
}
3511+
command_1.issueCommand('set-env', { name }, convertedVal);
35243512
}
35253513
exports.exportVariable = exportVariable;
35263514
/**
@@ -3538,7 +3526,7 @@ exports.setSecret = setSecret;
35383526
function addPath(inputPath) {
35393527
const filePath = process.env['GITHUB_PATH'] || '';
35403528
if (filePath) {
3541-
file_command_1.issueCommand('PATH', inputPath);
3529+
file_command_1.issueFileCommand('PATH', inputPath);
35423530
}
35433531
else {
35443532
command_1.issueCommand('add-path', {}, inputPath);
@@ -3578,7 +3566,10 @@ function getMultilineInput(name, options) {
35783566
const inputs = getInput(name, options)
35793567
.split('\n')
35803568
.filter(x => x !== '');
3581-
return inputs;
3569+
if (options && options.trimWhitespace === false) {
3570+
return inputs;
3571+
}
3572+
return inputs.map(input => input.trim());
35823573
}
35833574
exports.getMultilineInput = getMultilineInput;
35843575
/**
@@ -3611,8 +3602,12 @@ exports.getBooleanInput = getBooleanInput;
36113602
*/
36123603
// eslint-disable-next-line @typescript-eslint/no-explicit-any
36133604
function setOutput(name, value) {
3605+
const filePath = process.env['GITHUB_OUTPUT'] || '';
3606+
if (filePath) {
3607+
return file_command_1.issueFileCommand('OUTPUT', file_command_1.prepareKeyValueMessage(name, value));
3608+
}
36143609
process.stdout.write(os.EOL);
3615-
command_1.issueCommand('set-output', { name }, value);
3610+
command_1.issueCommand('set-output', { name }, utils_1.toCommandValue(value));
36163611
}
36173612
exports.setOutput = setOutput;
36183613
/**
@@ -3741,7 +3736,11 @@ exports.group = group;
37413736
*/
37423737
// eslint-disable-next-line @typescript-eslint/no-explicit-any
37433738
function saveState(name, value) {
3744-
command_1.issueCommand('save-state', { name }, value);
3739+
const filePath = process.env['GITHUB_STATE'] || '';
3740+
if (filePath) {
3741+
return file_command_1.issueFileCommand('STATE', file_command_1.prepareKeyValueMessage(name, value));
3742+
}
3743+
command_1.issueCommand('save-state', { name }, utils_1.toCommandValue(value));
37453744
}
37463745
exports.saveState = saveState;
37473746
/**
@@ -3807,13 +3806,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
38073806
return result;
38083807
};
38093808
Object.defineProperty(exports, "__esModule", ({ value: true }));
3810-
exports.issueCommand = void 0;
3809+
exports.prepareKeyValueMessage = exports.issueFileCommand = void 0;
38113810
// We use any as a valid input type
38123811
/* eslint-disable @typescript-eslint/no-explicit-any */
38133812
const fs = __importStar(__nccwpck_require__(7147));
38143813
const os = __importStar(__nccwpck_require__(2037));
3814+
const uuid_1 = __nccwpck_require__(8974);
38153815
const utils_1 = __nccwpck_require__(5278);
3816-
function issueCommand(command, message) {
3816+
function issueFileCommand(command, message) {
38173817
const filePath = process.env[`GITHUB_${command}`];
38183818
if (!filePath) {
38193819
throw new Error(`Unable to find environment variable for file command ${command}`);
@@ -3825,7 +3825,22 @@ function issueCommand(command, message) {
38253825
encoding: 'utf8'
38263826
});
38273827
}
3828-
exports.issueCommand = issueCommand;
3828+
exports.issueFileCommand = issueFileCommand;
3829+
function prepareKeyValueMessage(key, value) {
3830+
const delimiter = `ghadelimiter_${uuid_1.v4()}`;
3831+
const convertedValue = utils_1.toCommandValue(value);
3832+
// These should realistically never happen, but just in case someone finds a
3833+
// way to exploit uuid generation let's not allow keys or values that contain
3834+
// the delimiter.
3835+
if (key.includes(delimiter)) {
3836+
throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);
3837+
}
3838+
if (convertedValue.includes(delimiter)) {
3839+
throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);
3840+
}
3841+
return `${key}<<${delimiter}${os.EOL}${convertedValue}${os.EOL}${delimiter}`;
3842+
}
3843+
exports.prepareKeyValueMessage = prepareKeyValueMessage;
38293844
//# sourceMappingURL=file-command.js.map
38303845

38313846
/***/ }),

dist/setup/index.js

+36-21
Original file line numberDiff line numberDiff line change
@@ -3477,7 +3477,6 @@ const file_command_1 = __nccwpck_require__(717);
34773477
const utils_1 = __nccwpck_require__(5278);
34783478
const os = __importStar(__nccwpck_require__(2037));
34793479
const path = __importStar(__nccwpck_require__(1017));
3480-
const uuid_1 = __nccwpck_require__(8974);
34813480
const oidc_utils_1 = __nccwpck_require__(8041);
34823481
/**
34833482
* The code to exit an action
@@ -3507,20 +3506,9 @@ function exportVariable(name, val) {
35073506
process.env[name] = convertedVal;
35083507
const filePath = process.env['GITHUB_ENV'] || '';
35093508
if (filePath) {
3510-
const delimiter = `ghadelimiter_${uuid_1.v4()}`;
3511-
// 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.
3512-
if (name.includes(delimiter)) {
3513-
throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);
3514-
}
3515-
if (convertedVal.includes(delimiter)) {
3516-
throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);
3517-
}
3518-
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
3519-
file_command_1.issueCommand('ENV', commandValue);
3520-
}
3521-
else {
3522-
command_1.issueCommand('set-env', { name }, convertedVal);
3509+
return file_command_1.issueFileCommand('ENV', file_command_1.prepareKeyValueMessage(name, val));
35233510
}
3511+
command_1.issueCommand('set-env', { name }, convertedVal);
35243512
}
35253513
exports.exportVariable = exportVariable;
35263514
/**
@@ -3538,7 +3526,7 @@ exports.setSecret = setSecret;
35383526
function addPath(inputPath) {
35393527
const filePath = process.env['GITHUB_PATH'] || '';
35403528
if (filePath) {
3541-
file_command_1.issueCommand('PATH', inputPath);
3529+
file_command_1.issueFileCommand('PATH', inputPath);
35423530
}
35433531
else {
35443532
command_1.issueCommand('add-path', {}, inputPath);
@@ -3578,7 +3566,10 @@ function getMultilineInput(name, options) {
35783566
const inputs = getInput(name, options)
35793567
.split('\n')
35803568
.filter(x => x !== '');
3581-
return inputs;
3569+
if (options && options.trimWhitespace === false) {
3570+
return inputs;
3571+
}
3572+
return inputs.map(input => input.trim());
35823573
}
35833574
exports.getMultilineInput = getMultilineInput;
35843575
/**
@@ -3611,8 +3602,12 @@ exports.getBooleanInput = getBooleanInput;
36113602
*/
36123603
// eslint-disable-next-line @typescript-eslint/no-explicit-any
36133604
function setOutput(name, value) {
3605+
const filePath = process.env['GITHUB_OUTPUT'] || '';
3606+
if (filePath) {
3607+
return file_command_1.issueFileCommand('OUTPUT', file_command_1.prepareKeyValueMessage(name, value));
3608+
}
36143609
process.stdout.write(os.EOL);
3615-
command_1.issueCommand('set-output', { name }, value);
3610+
command_1.issueCommand('set-output', { name }, utils_1.toCommandValue(value));
36163611
}
36173612
exports.setOutput = setOutput;
36183613
/**
@@ -3741,7 +3736,11 @@ exports.group = group;
37413736
*/
37423737
// eslint-disable-next-line @typescript-eslint/no-explicit-any
37433738
function saveState(name, value) {
3744-
command_1.issueCommand('save-state', { name }, value);
3739+
const filePath = process.env['GITHUB_STATE'] || '';
3740+
if (filePath) {
3741+
return file_command_1.issueFileCommand('STATE', file_command_1.prepareKeyValueMessage(name, value));
3742+
}
3743+
command_1.issueCommand('save-state', { name }, utils_1.toCommandValue(value));
37453744
}
37463745
exports.saveState = saveState;
37473746
/**
@@ -3807,13 +3806,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
38073806
return result;
38083807
};
38093808
Object.defineProperty(exports, "__esModule", ({ value: true }));
3810-
exports.issueCommand = void 0;
3809+
exports.prepareKeyValueMessage = exports.issueFileCommand = void 0;
38113810
// We use any as a valid input type
38123811
/* eslint-disable @typescript-eslint/no-explicit-any */
38133812
const fs = __importStar(__nccwpck_require__(7147));
38143813
const os = __importStar(__nccwpck_require__(2037));
3814+
const uuid_1 = __nccwpck_require__(8974);
38153815
const utils_1 = __nccwpck_require__(5278);
3816-
function issueCommand(command, message) {
3816+
function issueFileCommand(command, message) {
38173817
const filePath = process.env[`GITHUB_${command}`];
38183818
if (!filePath) {
38193819
throw new Error(`Unable to find environment variable for file command ${command}`);
@@ -3825,7 +3825,22 @@ function issueCommand(command, message) {
38253825
encoding: 'utf8'
38263826
});
38273827
}
3828-
exports.issueCommand = issueCommand;
3828+
exports.issueFileCommand = issueFileCommand;
3829+
function prepareKeyValueMessage(key, value) {
3830+
const delimiter = `ghadelimiter_${uuid_1.v4()}`;
3831+
const convertedValue = utils_1.toCommandValue(value);
3832+
// These should realistically never happen, but just in case someone finds a
3833+
// way to exploit uuid generation let's not allow keys or values that contain
3834+
// the delimiter.
3835+
if (key.includes(delimiter)) {
3836+
throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);
3837+
}
3838+
if (convertedValue.includes(delimiter)) {
3839+
throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);
3840+
}
3841+
return `${key}<<${delimiter}${os.EOL}${convertedValue}${os.EOL}${delimiter}`;
3842+
}
3843+
exports.prepareKeyValueMessage = prepareKeyValueMessage;
38293844
//# sourceMappingURL=file-command.js.map
38303845

38313846
/***/ }),

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
@@ -24,7 +24,7 @@
2424
"license": "MIT",
2525
"dependencies": {
2626
"@actions/cache": "^3.0.4",
27-
"@actions/core": "^1.6.0",
27+
"@actions/core": "^1.10.0",
2828
"@actions/exec": "^1.1.0",
2929
"@actions/github": "^1.1.0",
3030
"@actions/glob": "^0.2.0",

0 commit comments

Comments
 (0)