From 5cf16d8439e34db6d820e058d00d3c8a840c0bf8 Mon Sep 17 00:00:00 2001 From: per1234 Date: Thu, 6 May 2021 18:05:05 -0700 Subject: [PATCH] Remove redundant default version code The default value of the version input is defined in the action metadata, so having another default setting in the code is purely redundant and doubles the maintenance effort required on every major release of Task (note that they already went out of sync). --- action.yml | 2 +- dist/index.js | 9 ++------- src/main.ts | 9 ++------- 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/action.yml b/action.yml index 7bee8e48..4b82edf1 100644 --- a/action.yml +++ b/action.yml @@ -4,7 +4,7 @@ author: "Arduino" inputs: version: description: "Version to use. Example: 3.4.2" - required: false + required: true default: "3.x" repo-token: description: "Token with permissions to do repo things" diff --git a/dist/index.js b/dist/index.js index e5cc12c8..b47fb0cc 100644 --- a/dist/index.js +++ b/dist/index.js @@ -266,14 +266,9 @@ const installer = __importStar(__nccwpck_require__(1480)); function run() { return __awaiter(this, void 0, void 0, function* () { try { - let version = core.getInput("version"); + const version = core.getInput("version", { required: true }); const repoToken = core.getInput("repo-token"); - if (!version) { - version = "2.x"; - } - if (version) { - yield installer.getTask(version, repoToken); - } + yield installer.getTask(version, repoToken); } catch (error) { core.setFailed(error.message); diff --git a/src/main.ts b/src/main.ts index 296d6599..bdbe842b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -15,15 +15,10 @@ import * as installer from "./installer"; async function run() { try { - let version = core.getInput("version"); + const version = core.getInput("version", { required: true }); const repoToken = core.getInput("repo-token"); - if (!version) { - version = "2.x"; - } - if (version) { - await installer.getTask(version, repoToken); - } + await installer.getTask(version, repoToken); } catch (error) { core.setFailed(error.message); }