8000 remove unnecessary dist call · actions/setup-node@141334f · GitHub
[go: up one dir, main page]

Skip to content

Commit 141334f

Browse files
committed
remove unnecessary dist call
1 parent 808c8f9 commit 141334f

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

dist/setup/index.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62346,6 +62346,7 @@ function getNode(versionSpec, stable, checkLatest, auth, arch = os.arch()) {
6234662346
let manifest;
6234762347
let osPlat = os.platform();
6234862348
let osArch = translateArchToDistUrl(arch);
62349+
let latestVersionResolved = false;
6234962350
if (isLtsAlias(versionSpec)) {
6235062351
core.info('Attempt to resolve LTS alias from manifest...');
6235162352
// No try-catch since it's not possible to resolve LTS alias without manifest
@@ -62365,6 +62366,7 @@ function getNode(versionSpec, stable, checkLatest, auth, arch = os.arch()) {
6236562366
}
6236662367
if (isLatestSyntax(versionSpec)) {
6236762368
versionSpec = yield queryDistForMatch(versionSpec, arch);
62369+
latestVersionResolved = true;
6236862370
core.info(`getting latest node version...`);
6236962371
}
6237062372
// check cache
@@ -62407,7 +62409,7 @@ function getNode(versionSpec, stable, checkLatest, auth, arch = os.arch()) {
6240762409
// Download from nodejs.org
6240862410
//
6240962411
if (!downloadPath) {
62410-
info = yield getInfoFromDist(versionSpec, arch);
62412+
info = yield getInfoFromDist(versionSpec, arch, latestVersionResolved);
6241162413
if (!info) {
6241262414
throw new Error(`Unable to find Node version '${versionSpec}' for platform ${osPlat} and architecture ${osArch}.`);
6241362415
}
@@ -62507,12 +62509,13 @@ function getInfoFromManifest(versionSpec, stable, auth, osArch = translateArchTo
6250762509
return info;
6250862510
});
6250962511
}
62510-
function getInfoFromDist(versionSpec, arch = os.arch()) {
62512+
function getInfoFromDist(versionSpec, arch = os.arch(), latestVersionResolved) {
6251162513
return __awaiter(this, void 0, void 0, function* () {
6251262514
let osPlat = os.platform();
6251362515
let osArch = translateArchToDistUrl(arch);
62514-
let version;
62515-
version = yield queryDistForMatch(versionSpec, arch);
62516+
let version = latestVersionResolved
62517+
? versionSpec
62518+
: yield queryDistForMatch(versionSpec, arch);
6251662519
if (!version) {
6251762520
return null;
6251862521
}

src/installer.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export async function getNode(
4040
let manifest: INodeRelease[] | undefined;
4141
let osPlat: string = os.platform();
4242
let osArch: string = translateArchToDistUrl(arch);
43+
let latestVersionResolved: boolean = false;
4344

4445
if (isLtsAlias(versionSpec)) {
4546
core.info('Attempt to resolve LTS alias from manifest...');
@@ -69,6 +70,7 @@ export async function getNode(
6970

7071
if (isLatestSyntax(versionSpec)) {
7172
versionSpec = await queryDistForMatch(versionSpec, arch);
73+
latestVersionResolved = true;
7274
core.info(`getting latest node version...`);
7375
}
7476

@@ -125,7 +127,7 @@ export async function getNode(
125127
// Download from nodejs.org
126128
//
127129
if (!downloadPath) {
128-
info = await getInfoFromDist(versionSpec, arch);
130+
info = await getInfoFromDist(versionSpec, arch, latestVersionResolved);
129131
if (!info) {
130132
throw new Error(
131133
`Unable to find Node version '${versionSpec}' for platform ${osPlat} and architecture ${osArch}.`
@@ -271,14 +273,16 @@ async function getInfoFromManifest(
271273

272274
async function getInfoFromDist(
273275
versionSpec: string,
274-
arch: string = os.arch()
276+
arch: string = os.arch(),
277+
latestVersionResolved?: boolean
275278
): Promise<INodeVersionInfo | null> {
276279
let osPlat: string = os.platform();
277280
let osArch: string = translateArchToDistUrl(arch);
278281

279-
let version: string;
282+
let version: string = latestVersionResolved
283+
? versionSpec
284+
: await queryDistForMatch(versionSpec, arch);
280285

281-
version = await queryDistForMatch(versionSpec, arch);
282286
if (!version) {
283287
return null;
284288
}

0 commit comments

Comments
 (0)
0