Skip to content

Commit 6f23314

Browse files
committed
#15: Update to Node16
1 parent 252d442 commit 6f23314

File tree

5 files changed

+73
-52
lines changed

5 files changed

+73
-52
lines changed

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ inputs:
6363
required: false
6464
default: ''
6565
runs:
66-
using: 'node12'
66+
using: 'node16'
6767
main: 'dist/index.js'
6868
branding:
6969
icon: 'bar-chart-2'

dist/index.js

Lines changed: 44 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,13 +1220,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
12201220
return result;
12211221
};
12221222
Object.defineProperty(exports, "__esModule", { value: true });
1223-
exports.issueCommand = void 0;
1223+
exports.prepareKeyValueMessage = exports.issueFileCommand = void 0;
12241224
// We use any as a valid input type
12251225
/* eslint-disable @typescript-eslint/no-explicit-any */
12261226
const fs = __importStar(__webpack_require__(747));
12271227
const os = __importStar(__webpack_require__(87));
1228+
const uuid_1 = __webpack_require__(62);
12281229
const utils_1 = __webpack_require__(82);
1229-
function issueCommand(command, message) {
1230+
function issueFileCommand(command, message) {
12301231
const filePath = process.env[`GITHUB_${command}`];
12311232
if (!filePath) {
12321233
throw new Error(`Unable to find environment variable for file command ${command}`);
@@ -1238,7 +1239,22 @@ function issueCommand(command, message) {
12381239
encoding: 'utf8'
12391240
});
12401241
}
1241-
exports.issueCommand = issueCommand;
1242+
exports.issueFileCommand = issueFileCommand;
1243+
function prepareKeyValueMessage(key, value) {
1244+
const delimiter = `ghadelimiter_${uuid_1.v4()}`;
1245+
const convertedValue = utils_1.toCommandValue(value);
1246+
// These should realistically never happen, but just in case someone finds a
1247+
// way to exploit uuid generation let's not allow keys or values that contain
1248+
// the delimiter.
1249+
if (key.includes(delimiter)) {
1250+
throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);
1251+
}
1252+
if (convertedValue.includes(delimiter)) {
1253+
throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);
1254+
}
1255+
return `${key}<<${delimiter}${os.EOL}${convertedValue}${os.EOL}${delimiter}`;
1256+
}
1257+
exports.prepareKeyValueMessage = prepareKeyValueMessage;
12421258
//# sourceMappingURL=file-command.js.map
12431259

12441260
/***/ }),
@@ -1719,7 +1735,11 @@ module.exports = require("timers");
17191735

17201736
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
17211737
if (k2 === undefined) k2 = k;
1722-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
1738+
var desc = Object.getOwnPropertyDescriptor(m, k);
1739+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
1740+
desc = { enumerable: true, get: function() { return m[k]; } };
1741+
}
1742+
Object.defineProperty(o, k2, desc);
17231743
}) : (function(o, m, k, k2) {
17241744
if (k2 === undefined) k2 = k;
17251745
o[k2] = m[k];
@@ -1770,9 +1790,10 @@ function run() {
17701790
core.setFailed(".NET Core SDK is not available.");
17711791
core.info("Please install with the following command in your YAML file:");
17721792
core.info("- name: Setup .NET Core");
1773-
core.info(" uses: actions/setup-dotnet@v1");
1793+
core.info(" uses: actions/setup-dotnet@v3");
17741794
core.info(" with");
1775-
core.info(" dotnet-version: '6.0.400'");
1795+
core.info(" dotnet-version: 6.x");
1796+
core.info(" dotnet-quality: 'ga'");
17761797
return;
17771798
}
17781799
core.info("Detected .NET Core SDK version '" + output + "'");
@@ -2726,7 +2747,6 @@ const file_command_1 = __webpack_require__(102);
27262747
const utils_1 = __webpack_require__(82);
27272748
const os = __importStar(__webpack_require__(87));
27282749
const path = __importStar(__webpack_require__(622));
2729-
const uuid_1 = __webpack_require__(62);
27302750
const oidc_utils_1 = __webpack_require__(742);
27312751
/**
27322752
* The code to exit an action
@@ -2756,20 +2776,9 @@ function exportVariable(name, val) {
27562776
process.env[name] = convertedVal;
27572777
const filePath = process.env['GITHUB_ENV'] || '';
27582778
if (filePath) {
2759-
const delimiter = `ghadelimiter_${uuid_1.v4()}`;
2760-
// 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.
2761-
if (name.includes(delimiter)) {
2762-
throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);
2763-
}
2764-
if (convertedVal.includes(delimiter)) {
2765-
throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);
2766-
}
2767-
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
2768-
file_command_1.issueCommand('ENV', commandValue);
2769-
}
2770-
else {
2771-
command_1.issueCommand('set-env', { name }, convertedVal);
2779+
return file_command_1.issueFileCommand('ENV', file_command_1.prepareKeyValueMessage(name, val));
27722780
}
2781+
command_1.issueCommand('set-env', { name }, convertedVal);
27732782
}
27742783
exports.exportVariable = exportVariable;
27752784
/**
@@ -2787,7 +2796,7 @@ exports.setSecret = setSecret;
27872796
function addPath(inputPath) {
27882797
const filePath = process.env['GITHUB_PATH'] || '';
27892798
if (filePath) {
2790-
file_command_1.issueCommand('PATH', inputPath);
2799+
file_command_1.issueFileCommand('PATH', inputPath);
27912800
}
27922801
else {
27932802
command_1.issueCommand('add-path', {}, inputPath);
@@ -2827,7 +2836,10 @@ function getMultilineInput(name, options) {
28272836
const inputs = getInput(name, options)
28282837
.split('\n')
28292838
.filter(x => x !== '');
2830-
return inputs;
2839+
if (options && options.trimWhitespace === false) {
2840+
return inputs;
2841+
}
2842+
return inputs.map(input => input.trim());
28312843
}
28322844
exports.getMultilineInput = getMultilineInput;
28332845
/**
@@ -2860,8 +2872,12 @@ exports.getBooleanInput = getBooleanInput;
28602872
*/
28612873
// eslint-disable-next-line @typescript-eslint/no-explicit-any
28622874
function setOutput(name, value) {
2875+
const filePath = process.env['GITHUB_OUTPUT'] || '';
2876+
if (filePath) {
2877+
return file_command_1.issueFileCommand('OUTPUT', file_command_1.prepareKeyValueMessage(name, value));
2878+
}
28632879
process.stdout.write(os.EOL);
2864-
command_1.issueCommand('set-output', { name }, value);
2880+
command_1.issueCommand('set-output', { name }, utils_1.toCommandValue(value));
28652881
}
28662882
exports.setOutput = setOutput;
28672883
/**
@@ -2990,7 +3006,11 @@ exports.group = group;
29903006
*/
29913007
// eslint-disable-next-line @typescript-eslint/no-explicit-any
29923008
function saveState(name, value) {
2993-
command_1.issueCommand('save-state', { name }, value);
3009+
const filePath = process.env['GITHUB_STATE'] || '';
3010+
if (filePath) {
3011+
return file_command_1.issueFileCommand('STATE', file_command_1.prepareKeyValueMessage(name, value));
3012+
}
3013+
command_1.issueCommand('save-state', { name }, utils_1.toCommandValue(value));
29943014
}
29953015
exports.saveState = saveState;
29963016
/**

package-lock.json

Lines changed: 21 additions & 21 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
@@ -16,12 +16,12 @@
1616
"author": "danielpalme",
1717
"license": "Apache-2.0",
1818
"dependencies": {
19-
"@actions/core": "^1.9.1",
19+
"@actions/core": "^1.10.0",
2020
"@actions/exec": "^1.1.1"
2121
},
2222
"devDependencies": {
2323
"@zeit/ncc": "^0.22.3",
24-
"typescript": "^4.0.3",
25-
"@types/node": "^14.11.2"
24+
"typescript": "^4.8.4",
25+
"@types/node": "^18.8.5"
2626
}
2727
}

src/reportgenerator.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ async function run() {
2828
core.setFailed(".NET Core SDK is not available.");
2929
core.info("Please install with the following command in your YAML file:");
3030
core.info("- name: Setup .NET Core");
31-
core.info(" uses: actions/setup-dotnet@v1");
31+
core.info(" uses: actions/setup-dotnet@v3");
3232
core.info(" with");
33-
core.info(" dotnet-version: '6.0.400'");
33+
core.info(" dotnet-version: 6.x");
34+
core.info(" dotnet-quality: 'ga'");
3435
return;
3536
}
3637

@@ -112,7 +113,7 @@ async function run() {
112113
}
113114

114115
core.info("Successfully executed ReportGenerator");
115-
} catch (error) {
116+
} catch (error: any) {
116117
core.setFailed(error.message);
117118
}
118119
}

0 commit comments

Comments
 (0)