Skip to content

Commit 45e544a

Browse files
committed
fix versionSpec required error
1 parent 8c66f89 commit 45e544a

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/installer.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ export async function getNode(
6666
}
6767
}
6868

69-
if (['current', 'latest', 'node'].includes(versionSpec)) {
70-
versionSpec = await queryDistForMatch(versionSpec, arch);
69+
if(['current', 'latest', 'node'].includes(versionSpec)) {
70+
versionSpec = await queryDistForMatch(versionSpec, arch);
7171
core.info(`getting latest node version...`);
7272
}
7373

@@ -378,6 +378,15 @@ async function queryDistForMatch(
378378
let versions: string[] = [];
379379
let nodeVersions = await getVersionsFromDist();
380380

381+
if (
382+
versionSpec === 'current' ||
383+
versionSpec === 'latest' ||
384+
versionSpec === 'node'
385+
) {
386+
core.info(`getting latest node version...`);
387+
return nodeVersions[0].version;
388+
}
389+
381390
nodeVersions.forEach((nodeVersion: INodeVersion) => {
382391
// ensure this version supports your os and platform
383392
if (nodeVersion.files.indexOf(dataFileName) >= 0) {

0 commit comments

Comments
 (0)