Fix caching tool

This commit is contained in:
Shaharia Azam 2022-05-18 12:36:29 +02:00
parent 0ec838fa2f
commit c321a4f62a

View file

@ -137,17 +137,16 @@ async function run () {
throw new Error(`Terraform version ${version} not available for ${platform} and ${arch}`); throw new Error(`Terraform version ${version} not available for ${platform} and ${arch}`);
} }
const nodeDirectory = tc.find('terraform', version, arch); const pathToCLI = tc.find('terraform', version, arch);
console.info(nodeDirectory); if (!pathToCLI) {
if (!nodeDirectory) {
// Download requested version // Download requested version
const pathToCLI = await downloadCLI(build.url); const pathToCLI = await downloadCLI(build.url);
const cachedPath = await tc.cacheDir(pathToCLI, 'terraform', version); // add tool in cache
const cachedPath = await tc.cacheDir(pathToCLI, 'terraform', version, arch);
core.addPath(cachedPath); core.addPath(cachedPath);
} }
// Install our wrapper // Install our wrapper
if (wrapper) { if (wrapper) {
await installWrapper(pathToCLI); await installWrapper(pathToCLI);