Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitry-shibanov committed Dec 5, 2022
1 parent eb4d2dd commit f623296
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
12 changes: 9 additions & 3 deletions dist/setup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63484,11 +63484,17 @@ function resolveStableVersionInput(versionSpec, auth, arch = os_1.default.arch()
return __awaiter(this, void 0, void 0, function* () {
if (!manifest) {
core.debug('No manifest cached');
manifest = (yield getManifest(auth));
manifest = yield getManifest(auth);
}
const releases = manifest
.filter(release => !!release.files.find(file => file.arch === arch))
.map(release => release.version);
.map(item => {
const index = item.files.findIndex(item => item.arch === arch);
if (index === -1) {
return '';
}
return item.version;
})
.filter(item => !!item);
if (versionSpec === utils_1.StableReleaseAlias.Stable) {
core.info(`stable version resolved as ${releases[0]}`);
return releases[0];
Expand Down
18 changes: 12 additions & 6 deletions src/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export async function getGo(
versionSpec,
auth,
arch,
manifest as (tc.IToolRelease & IGoVersion)[]
manifest
);
}

Expand Down Expand Up @@ -279,7 +279,7 @@ export async function findMatch(
versionSpec,
undefined,
arch,
fixedCandidates as (tc.IToolRelease & IGoVersion)[]
fixedCandidates
);
}

Expand Down Expand Up @@ -375,16 +375,22 @@ export async function resolveStableVersionInput(
versionSpec: string,
auth: string | undefined,
arch = os.arch(),
manifest: (tc.IToolRelease & IGoVersion)[] | undefined
manifest: tc.IToolRelease[] | IGoVersion[] | undefined
): Promise<string> {
if (!manifest) {
core.debug('No manifest cached');
manifest = (await getManifest(auth)) as (tc.IToolRelease & IGoVersion)[];
manifest = await getManifest(auth);
}

const releases = manifest
.filter(release => !!release.files.find(file => file.arch === arch))
.map(release => release.version);
.map(item => {
const index = item.files.findIndex(item => item.arch === arch);
if (index === -1) {
return '';
}
return item.version;
})
.filter(item => !!item);

if (versionSpec === StableReleaseAlias.Stable) {
core.info(`stable version resolved as ${releases[0]}`);
Expand Down

0 comments on commit f623296

Please sign in to comment.