squash! Avoid Toolchain download before cache download

Also handle lookups on cache restore
pull/456/head
Matthew Hughes 1 year ago
parent ebf50616f3
commit fc872ec4d1

@ -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…
Cancel
Save