Return alias condition to main

This commit is contained in:
panticmilos 2022-11-23 18:50:03 +01:00
parent a29996aa9d
commit 18c62c8dd3
3 changed files with 22 additions and 21 deletions

View file

@ -56,18 +56,6 @@ export async function getGo(
}
}
if (
versionSpec === StableReleaseAlias.Stable ||
versionSpec === StableReleaseAlias.OldStable
) {
versionSpec = await resolveStableVersionInput(
versionSpec,
auth,
arch,
manifest
);
}
// check cache
let toolPath: string;
toolPath = tc.find('go', versionSpec, arch);
@ -354,7 +342,7 @@ export function parseGoVersionFile(versionFilePath: string): string {
return contents.trim();
}
async function resolveStableVersionInput(
export async function resolveStableVersionInput(
versionSpec: string,
auth: string | undefined,
arch = os.arch(),

View file

@ -8,7 +8,6 @@ import {isCacheFeatureAvailable} from './cache-utils';
import cp from 'child_process';
import fs from 'fs';
import os from 'os';
import {IToolRelease} from '@actions/tool-cache';
import {StableReleaseAlias} from './utils';
export async function run() {
@ -17,7 +16,7 @@ export async function run() {
// versionSpec is optional. If supplied, install / use from the tool cache
// If not supplied then problem matchers will still be setup. Useful for self-hosted.
//
const versionSpec = resolveVersionInput();
let versionSpec = resolveVersionInput();
const cache = core.getBooleanInput('cache');
core.info(`Setup go version spec ${versionSpec}`);
@ -36,6 +35,18 @@ export async function run() {
const checkLatest = core.getBooleanInput('check-latest');
if (
versionSpec === StableReleaseAlias.Stable ||
versionSpec === StableReleaseAlias.OldStable
) {
versionSpec = await installer.resolveStableVersionInput(
versionSpec,
auth,
arch,
manifest
);
}
const installDir = await installer.getGo(
versionSpec,
checkLatest,