From 989752598dc3cdd90c1cfdbbd9f83c759fb56c05 Mon Sep 17 00:00:00 2001 From: Quentin Laplanche <48560996+quentin-laplanche@users.noreply.github.com> Date: Thu, 22 Jun 2023 16:01:00 +0200 Subject: [PATCH] fix: Make Go installer respect cache input --- src/installer.ts | 15 +++++++++------ src/main.ts | 3 ++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/installer.ts b/src/installer.ts index 013fb64..dbb7351 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -34,7 +34,8 @@ export async function getGo( versionSpec: string, checkLatest: boolean, auth: string | undefined, - arch = os.arch() + arch = os.arch(), + cache: boolean ) { let manifest: tc.IToolRelease[] | undefined; const osPlat: string = os.platform(); @@ -83,11 +84,13 @@ export async function getGo( } // check cache - const toolPath = tc.find('go', versionSpec, arch); - // If not found in cache, download - if (toolPath) { - core.info(`Found in cache @ ${toolPath}`); - return toolPath; + if (cache) { + const toolPath = tc.find('go', versionSpec, arch); + // If not found in cache, download + if (toolPath) { + core.info(`Found in cache @ ${toolPath}`); + return toolPath; + } } core.info(`Attempting to download ${versionSpec}...`); let downloadPath = ''; diff --git a/src/main.ts b/src/main.ts index d3fb857..d1213eb 100644 --- a/src/main.ts +++ b/src/main.ts @@ -36,7 +36,8 @@ export async function run() { versionSpec, checkLatest, auth, - arch + arch, + cache ); const installDirVersion = path.basename(path.dirname(installDir));