From 7eec3d790de74b1ac9224b1f4ed0359769449caf Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Sat, 10 Jul 2021 02:10:33 +0530 Subject: [PATCH] Fix repeated version_prefix --- dist/index.js | 3 ++- src/tools.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index f337754b..73a6d40d 100644 --- a/dist/index.js +++ b/dist/index.js @@ -505,7 +505,8 @@ async function getToolSemver(data) { return data['version']; } else { - return JSON.parse(response['data']).pop()['ref'].split('/').pop(); + const tag = JSON.parse(response['data']).pop()['ref'].split('/').pop(); + return tag.replace(/^v(\d)/, '$1'); } } exports.getToolSemver = getToolSemver; diff --git a/src/tools.ts b/src/tools.ts index 322876f8..32cd2b44 100644 --- a/src/tools.ts +++ b/src/tools.ts @@ -11,7 +11,8 @@ export async function getToolSemver( data['error'] = response.error ?? `No version found with prefix ${ref}.`; return data['version']; } else { - return JSON.parse(response['data']).pop()['ref'].split('/').pop(); + const tag = JSON.parse(response['data']).pop()['ref'].split('/').pop(); + return tag.replace(/^v(\d)/, '$1'); } }