Skip to content

Commit 52c0067

Browse files
fix: update actions-core + node 18
1 parent 93b9933 commit 52c0067

File tree

5 files changed

+1744
-823
lines changed

5 files changed

+1744
-823
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
node_modules
2+
.yarn

.yarnrc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodeLinker: node-modules

dist/index.js

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -298,13 +298,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
298298
return result;
299299
};
300300
Object.defineProperty(exports, "__esModule", { value: true });
301-
exports.issueCommand = void 0;
301+
exports.prepareKeyValueMessage = exports.issueFileCommand = void 0;
302302
// We use any as a valid input type
303303
/* eslint-disable @typescript-eslint/no-explicit-any */
304304
const fs = __importStar(__webpack_require__(747));
305305
const os = __importStar(__webpack_require__(87));
306+
const uuid_1 = __webpack_require__(62);
306307
const utils_1 = __webpack_require__(82);
307-
function issueCommand(command, message) {
308+
function issueFileCommand(command, message) {
308309
const filePath = process.env[`GITHUB_${command}`];
309310
if (!filePath) {
310311
throw new Error(`Unable to find environment variable for file command ${command}`);
@@ -316,7 +317,22 @@ function issueCommand(command, message) {
316317
encoding: 'utf8'
317318
});
318319
}
319-
exports.issueCommand = issueCommand;
320+
exports.issueFileCommand = issueFileCommand;
321+
function prepareKeyValueMessage(key, value) {
322+
const delimiter = `ghadelimiter_${uuid_1.v4()}`;
323+
const convertedValue = utils_1.toCommandValue(value);
324+
// These should realistically never happen, but just in case someone finds a
325+
// way to exploit uuid generation let's not allow keys or values that contain
326+
// the delimiter.
327+
if (key.includes(delimiter)) {
328+
throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);
329+
}
330+
if (convertedValue.includes(delimiter)) {
331+
throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);
332+
}
333+
return `${key}<<${delimiter}${os.EOL}${convertedValue}${os.EOL}${delimiter}`;
334+
}
335+
exports.prepareKeyValueMessage = prepareKeyValueMessage;
320336
//# sourceMappingURL=file-command.js.map
321337

322338
/***/ }),
@@ -1671,7 +1687,6 @@ const file_command_1 = __webpack_require__(102);
16711687
const utils_1 = __webpack_require__(82);
16721688
const os = __importStar(__webpack_require__(87));
16731689
const path = __importStar(__webpack_require__(622));
1674-
const uuid_1 = __webpack_require__(62);
16751690
const oidc_utils_1 = __webpack_require__(742);
16761691
/**
16771692
* The code to exit an action
@@ -1701,20 +1716,9 @@ function exportVariable(name, val) {
17011716
process.env[name] = convertedVal;
17021717
const filePath = process.env['GITHUB_ENV'] || '';
17031718
if (filePath) {
1704-
const delimiter = `ghadelimiter_${uuid_1.v4()}`;
1705-
// 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.
1706-
if (name.includes(delimiter)) {
1707-
throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);
1708-
}
1709-
if (convertedVal.includes(delimiter)) {
1710-
throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);
1711-
}
1712-
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
1713-
file_command_1.issueCommand('ENV', commandValue);
1714-
}
1715-
else {
1716-
command_1.issueCommand('set-env', { name }, convertedVal);
1719+
return file_command_1.issueFileCommand('ENV', file_command_1.prepareKeyValueMessage(name, val));
17171720
}
1721+
command_1.issueCommand('set-env', { name }, convertedVal);
17181722
}
17191723
exports.exportVariable = exportVariable;
17201724
/**
@@ -1732,7 +1736,7 @@ exports.setSecret = setSecret;
17321736
function addPath(inputPath) {
17331737
const filePath = process.env['GITHUB_PATH'] || '';
17341738
if (filePath) {
1735-
file_command_1.issueCommand('PATH', inputPath);
1739+
file_command_1.issueFileCommand('PATH', inputPath);
17361740
}
17371741
else {
17381742
command_1.issueCommand('add-path', {}, inputPath);
@@ -1772,7 +1776,10 @@ function getMultilineInput(name, options) {
17721776
const inputs = getInput(name, options)
17731777
.split('\n')
17741778
.filter(x => x !== '');
1775-
return inputs;
1779+
if (options && options.trimWhitespace === false) {
1780+
return inputs;
1781+
}
1782+
return inputs.map(input => input.trim());
17761783
}
17771784
exports.getMultilineInput = getMultilineInput;
17781785
/**
@@ -1805,8 +1812,12 @@ exports.getBooleanInput = getBooleanInput;
18051812
*/
18061813
// eslint-disable-next-line @typescript-eslint/no-explicit-any
18071814
function setOutput(name, value) {
1815+
const filePath = process.env['GITHUB_OUTPUT'] || '';
1816+
if (filePath) {
1817+
return file_command_1.issueFileCommand('OUTPUT', file_command_1.prepareKeyValueMessage(name, value));
1818+
}
18081819
process.stdout.write(os.EOL);
1809-
command_1.issueCommand('set-output', { name }, value);
1820+
command_1.issueCommand('set-output', { name }, utils_1.toCommandValue(value));
18101821
}
18111822
exports.setOutput = setOutput;
18121823
/**
@@ -1935,7 +1946,11 @@ exports.group = group;
19351946
*/
19361947
// eslint-disable-next-line @typescript-eslint/no-explicit-any
19371948
function saveState(name, value) {
1938-
command_1.issueCommand('save-state', { name }, value);
1949+
const filePath = process.env['GITHUB_STATE'] || '';
1950+
if (filePath) {
1951+
return file_command_1.issueFileCommand('STATE', file_command_1.prepareKeyValueMessage(name, value));
1952+
}
1953+
command_1.issueCommand('save-state', { name }, utils_1.toCommandValue(value));
19391954
}
19401955
exports.saveState = saveState;
19411956
/**

package.json

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,22 @@
2424
"homepage": "https://github.com/codaline-io/node-versionless-cache-key",
2525
"license": "MIT",
2626
"scripts": {
27-
"package": "ncc build index.js -o dist",
27+
"package": "cross-env NODE_OPTIONS=--openssl-legacy-provider ncc build index.js -o dist",
2828
"lint": "eslint *.js"
2929
},
3030
"dependencies": {
31-
"@actions/core": "^1.9.1"
31+
"@actions/core": "^1.10.0"
3232
},
3333
"devDependencies": {
3434
"@zeit/ncc": "^0.22.3",
35-
"eslint": "^8.23.1"
35+
"cross-env": "^7.0.3",
36+
"eslint": "^8.31.0"
37+
},
38+
"engines": {
39+
"node": "18.12.1"
40+
},
41+
"volta": {
42+
"node": "18.12.1",
43+
"yarn": "3.3.1"
3644
}
3745
}

0 commit comments

Comments
 (0)