Merge pull request #323 from e-korolevskii/use-actual-version-in-cache

Use actual version in cache
This commit is contained in:
Marko Zivic 2023-01-31 13:55:36 +01:00 committed by GitHub
commit a3d889c34c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 6 deletions

6
dist/setup/index.js vendored
View file

@ -63602,17 +63602,17 @@ function run() {
core.debug(`add bin ${added}`); core.debug(`add bin ${added}`);
core.info(`Successfully set up Go version ${versionSpec}`); core.info(`Successfully set up Go version ${versionSpec}`);
} }
let goPath = yield io.which('go');
let goVersion = (child_process_1.default.execSync(`${goPath} version`) || '').toString();
if (cache && cache_utils_1.isCacheFeatureAvailable()) { if (cache && cache_utils_1.isCacheFeatureAvailable()) {
const packageManager = 'default'; const packageManager = 'default';
const cacheDependencyPath = core.getInput('cache-dependency-path'); const cacheDependencyPath = core.getInput('cache-dependency-path');
yield cache_restore_1.restoreCache(versionSpec, packageManager, cacheDependencyPath); yield cache_restore_1.restoreCache(parseGoVersion(goVersion), packageManager, cacheDependencyPath);
} }
// add problem matchers // add problem matchers
const matchersPath = path_1.default.join(__dirname, '../..', 'matchers.json'); const matchersPath = path_1.default.join(__dirname, '../..', 'matchers.json');
core.info(`##[add-matcher]${matchersPath}`); core.info(`##[add-matcher]${matchersPath}`);
// output the version actually being used // output the version actually being used
const goPath = yield io.which('go');
const goVersion = (child_process_1.default.execSync(`${goPath} version`) || '').toString();
core.info(goVersion); core.info(goVersion);
core.setOutput('go-version', parseGoVersion(goVersion)); core.setOutput('go-version', parseGoVersion(goVersion));
core.startGroup('go env'); core.startGroup('go env');

View file

@ -56,10 +56,17 @@ export async function run() {
core.info(`Successfully set up Go version ${versionSpec}`); core.info(`Successfully set up Go version ${versionSpec}`);
} }
let goPath = await io.which('go');
let goVersion = (cp.execSync(`${goPath} version`) || '').toString();
if (cache && isCacheFeatureAvailable()) { if (cache && isCacheFeatureAvailable()) {
const packageManager = 'default'; const packageManager = 'default';
const cacheDependencyPath = core.getInput('cache-dependency-path'); const cacheDependencyPath = core.getInput('cache-dependency-path');
await restoreCache(versionSpec, packageManager, cacheDependencyPath); await restoreCache(
parseGoVersion(goVersion),
packageManager,
cacheDependencyPath
);
} }
// add problem matchers // add problem matchers
@ -67,8 +74,6 @@ export async function run() {
core.info(`##[add-matcher]${matchersPath}`); core.info(`##[add-matcher]${matchersPath}`);
// output the version actually being used // output the version actually being used
const goPath = await io.which('go');
const goVersion = (cp.execSync(`${goPath} version`) || '').toString();
core.info(goVersion); core.info(goVersion);
core.setOutput('go-version', parseGoVersion(goVersion)); core.setOutput('go-version', parseGoVersion(goVersion));