From 0ec838fa2f21a72d5a6c41b82c947fcdff1a5937 Mon Sep 17 00:00:00 2001 From: Shaharia Azam Date: Wed, 18 May 2022 10:10:39 +0200 Subject: [PATCH] Initial fix --- lib/setup-terraform.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/setup-terraform.js b/lib/setup-terraform.js index 1e61d2c..f6a7a1e 100644 --- a/lib/setup-terraform.js +++ b/lib/setup-terraform.js @@ -137,9 +137,17 @@ async function run () { throw new Error(`Terraform version ${version} not available for ${platform} and ${arch}`); } - // Download requested version - const pathToCLI = await downloadCLI(build.url); + const nodeDirectory = tc.find('terraform', version, arch); + console.info(nodeDirectory); + if (!nodeDirectory) { + // Download requested version + const pathToCLI = await downloadCLI(build.url); + + const cachedPath = await tc.cacheDir(pathToCLI, 'terraform', version); + core.addPath(cachedPath); + } + // Install our wrapper if (wrapper) { await installWrapper(pathToCLI);