From 45e544a71a30e9753c47c60ffa6894206879eca6 Mon Sep 17 00:00:00 2001
From: panticmilos <panticmilos@github.com>
Date: Thu, 19 May 2022 17:02:08 +0200
Subject: [PATCH] fix versionSpec required error

---
 src/installer.ts | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/installer.ts b/src/installer.ts
index fb35d73..4029b59 100644
--- a/src/installer.ts
+++ b/src/installer.ts
@@ -66,8 +66,8 @@ export async function getNode(
     }
   }
 
-  if (['current', 'latest', 'node'].includes(versionSpec)) {
-    versionSpec = await queryDistForMatch(versionSpec, arch);
+  if(['current', 'latest', 'node'].includes(versionSpec)) {
+    versionSpec = await queryDistForMatch(versionSpec, arch); 
     core.info(`getting latest node version...`);
   }
 
@@ -378,6 +378,15 @@ async function queryDistForMatch(
   let versions: string[] = [];
   let nodeVersions = await getVersionsFromDist();
 
+  if (
+    versionSpec === 'current' ||
+    versionSpec === 'latest' ||
+    versionSpec === 'node'
+  ) {
+    core.info(`getting latest node version...`);
+    return nodeVersions[0].version;
+  }
+
   nodeVersions.forEach((nodeVersion: INodeVersion) => {
     // ensure this version supports your os and platform
     if (nodeVersion.files.indexOf(dataFileName) >= 0) {