From 8b65541eb319bdef8a5d7fc45176d5de54b6f638 Mon Sep 17 00:00:00 2001 From: aparnajyothi-y <147696841+aparnajyothi-y@users.noreply.github.com> Date: Tue, 12 Dec 2023 14:10:38 +0530 Subject: [PATCH] cachefix --- src/cache-save.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/cache-save.ts b/src/cache-save.ts index 4499e9997..f643655c9 100644 --- a/src/cache-save.ts +++ b/src/cache-save.ts @@ -12,10 +12,16 @@ process.on('uncaughtException', e => { core.info(`${warningPrefix}${e.message}`); }); -export async function run() { +export async function run(earlyExit?: boolean) { try { - const cacheLock = core.getState(State.CachePackageManager); - await cachePackages(cacheLock); + const cacheInput = core.getBooleanInput('cache'); + if (cacheInput) { + await cachePackages(); + + if (earlyExit) { + process.exit(0); + } + } } catch (error) { core.setFailed((error as Error).message); } @@ -29,10 +35,7 @@ const cachePackages = async (packageManager: string) => { ) as string[]; const packageManagerInfo = await getPackageManagerInfo(packageManager); - if (!packageManagerInfo) { - core.debug(`Caching for '${packageManager}' is not supported`); - return; - } + if (!cachePaths.length) { // TODO: core.getInput has a bug - it can return undefined despite its definition (tests only?)