From e045d11f3924952b9c732dcb706b1f85443086cb Mon Sep 17 00:00:00 2001 From: rgsubh <64013610+rgsubh@users.noreply.github.com> Date: Thu, 14 May 2020 12:06:39 +0530 Subject: [PATCH] Changed the documentation to specify v before 'version' and code changes to append 'v' if it not provided in version (#11) * Chnaged the documentation to sepcify v before 'version' * append v to version incase it does not already include * review comments fix --- README.md | 2 +- lib/run.js | 3 +++ src/run.ts | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c1c6cfdb..38f90cdc 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Setup Helm #### Install a specific version of helm binary on the runner. -Acceptable values are latest or any semantic version string like `1.15.0`. Use this action in workflow to define which version of helm will be used. +Acceptable values are latest or any semantic version string like v2.16.7 Use this action in workflow to define which version of helm will be used. ```yaml - uses: azure/setup-helm@v1 diff --git a/lib/run.js b/lib/run.js index 40dd3fa2..550c95fa 100644 --- a/lib/run.js +++ b/lib/run.js @@ -130,6 +130,9 @@ function run() { if (version.toLocaleLowerCase() === 'latest') { version = yield getStableHelmVersion(); } + else if (!version.toLocaleLowerCase().startsWith('v')) { + version = 'v' + version; + } let cachedPath = yield downloadHelm(version); try { if (!process.env['PATH'].startsWith(path.dirname(cachedPath))) { diff --git a/src/run.ts b/src/run.ts index 46aaf43d..aafcf7ec 100644 --- a/src/run.ts +++ b/src/run.ts @@ -120,6 +120,8 @@ async function run() { let version = core.getInput('version', { 'required': true }); if (version.toLocaleLowerCase() === 'latest') { version = await getStableHelmVersion(); + } else if (!version.toLocaleLowerCase().startsWith('v')) { + version = 'v' + version; } let cachedPath = await downloadHelm(version);