mirror of
https://github.com/actions/setup-go.git
synced 2025-04-23 17:40:50 +00:00
squash! Avoid Toolchain download before cache download
Also handle lookups on cache restore
This commit is contained in:
parent
ebf50616f3
commit
fc872ec4d1
2 changed files with 11 additions and 5 deletions
|
@ -16,7 +16,9 @@ export const restoreCache = async (
|
||||||
const packageManagerInfo = await getPackageManagerInfo(packageManager);
|
const packageManagerInfo = await getPackageManagerInfo(packageManager);
|
||||||
const platform = process.env.RUNNER_OS;
|
const platform = process.env.RUNNER_OS;
|
||||||
|
|
||||||
const cachePaths = await getCacheDirectoryPath(packageManagerInfo);
|
const cachePaths = await getCacheDirectoryPath(packageManagerInfo, {
|
||||||
|
env: {...process.env, GOTOOLCHAIN: 'local'}
|
||||||
|
});
|
||||||
|
|
||||||
const dependencyFilePath = cacheDependencyPath
|
const dependencyFilePath = cacheDependencyPath
|
||||||
? cacheDependencyPath
|
? cacheDependencyPath
|
||||||
|
|
|
@ -3,11 +3,14 @@ import * as core from '@actions/core';
|
||||||
import * as exec from '@actions/exec';
|
import * as exec from '@actions/exec';
|
||||||
import {supportedPackageManagers, PackageManagerInfo} from './package-managers';
|
import {supportedPackageManagers, PackageManagerInfo} from './package-managers';
|
||||||
|
|
||||||
export const getCommandOutput = async (toolCommand: string) => {
|
export const getCommandOutput = async (
|
||||||
|
toolCommand: string,
|
||||||
|
execOpts?: exec.ExecOptions
|
||||||
|
) => {
|
||||||
let {stdout, stderr, exitCode} = await exec.getExecOutput(
|
let {stdout, stderr, exitCode} = await exec.getExecOutput(
|
||||||
toolCommand,
|
toolCommand,
|
||||||
undefined,
|
undefined,
|
||||||
{ignoreReturnCode: true}
|
{...execOpts, ignoreReturnCode: true}
|
||||||
);
|
);
|
||||||
|
|
||||||
if (exitCode) {
|
if (exitCode) {
|
||||||
|
@ -32,11 +35,12 @@ export const getPackageManagerInfo = async (packageManager: string) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getCacheDirectoryPath = async (
|
export const getCacheDirectoryPath = async (
|
||||||
packageManagerInfo: PackageManagerInfo
|
packageManagerInfo: PackageManagerInfo,
|
||||||
|
execOpts?: exec.ExecOptions
|
||||||
) => {
|
) => {
|
||||||
const pathOutputs = await Promise.allSettled(
|
const pathOutputs = await Promise.allSettled(
|
||||||
packageManagerInfo.cacheFolderCommandList.map(async command =>
|
packageManagerInfo.cacheFolderCommandList.map(async command =>
|
||||||
getCommandOutput(command)
|
getCommandOutput(command, execOpts)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue