mirror of
https://github.com/actions/setup-go.git
synced 2025-04-24 01:50:52 +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 platform = process.env.RUNNER_OS;
|
||||
|
||||
const cachePaths = await getCacheDirectoryPath(packageManagerInfo);
|
||||
const cachePaths = await getCacheDirectoryPath(packageManagerInfo, {
|
||||
env: {...process.env, GOTOOLCHAIN: 'local'}
|
||||
});
|
||||
|
||||
const dependencyFilePath = cacheDependencyPath
|
||||
? cacheDependencyPath
|
||||
|
|
|
@ -3,11 +3,14 @@ import * as core from '@actions/core';
|
|||
import * as exec from '@actions/exec';
|
||||
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(
|
||||
toolCommand,
|
||||
undefined,
|
||||
{ignoreReturnCode: true}
|
||||
{...execOpts, ignoreReturnCode: true}
|
||||
);
|
||||
|
||||
if (exitCode) {
|
||||
|
@ -32,11 +35,12 @@ export const getPackageManagerInfo = async (packageManager: string) => {
|
|||
};
|
||||
|
||||
export const getCacheDirectoryPath = async (
|
||||
packageManagerInfo: PackageManagerInfo
|
||||
packageManagerInfo: PackageManagerInfo,
|
||||
execOpts?: exec.ExecOptions
|
||||
) => {
|
||||
const pathOutputs = await Promise.allSettled(
|
||||
packageManagerInfo.cacheFolderCommandList.map(async command =>
|
||||
getCommandOutput(command)
|
||||
getCommandOutput(command, execOpts)
|
||||
)
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue