From 2875322ba94fe173d4ce4cddeb5b68d5acae2366 Mon Sep 17 00:00:00 2001 From: rak Date: Tue, 18 Mar 2025 22:58:58 +0100 Subject: [PATCH] Fix cache-hit state boolean cast --- dist/cleanup/index.js | 7 +++---- dist/setup/index.js | 7 +++---- src/cache.ts | 7 +++---- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/dist/cleanup/index.js b/dist/cleanup/index.js index 6dddd36e..2325d641 100644 --- a/dist/cleanup/index.js +++ b/dist/cleanup/index.js @@ -96664,15 +96664,14 @@ function save(id) { const packageManager = findPackageManager(id); // Inputs are re-evaluated before the post action, so we want the original key used for restore const primaryKey = core.getState(STATE_CACHE_PRIMARY_KEY); - const cacheHitString = core.getState(STATE_CACHE_HIT); - const cacheHit = Boolean(cacheHitString); + const cacheHit = core.getState(STATE_CACHE_HIT); if (!primaryKey) { core.warning('Error retrieving key from state.'); return; } - else if (cacheHit) { + else if (!!cacheHit) { // no change in target directories - core.info(`${cacheHitString}: Cache hit occurred on the primary key ${primaryKey}, not saving cache.`); + core.info(`${cacheHit}: Cache hit occurred on the primary key ${primaryKey}, not saving cache.`); return; } try { diff --git a/dist/setup/index.js b/dist/setup/index.js index 27487b05..6035498c 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -131913,15 +131913,14 @@ function save(id) { const packageManager = findPackageManager(id); // Inputs are re-evaluated before the post action, so we want the original key used for restore const primaryKey = core.getState(STATE_CACHE_PRIMARY_KEY); - const cacheHitString = core.getState(STATE_CACHE_HIT); - const cacheHit = Boolean(cacheHitString); + const cacheHit = core.getState(STATE_CACHE_HIT); if (!primaryKey) { core.warning('Error retrieving key from state.'); return; } - else if (cacheHit) { + else if (!!cacheHit) { // no change in target directories - core.info(`${cacheHitString}: Cache hit occurred on the primary key ${primaryKey}, not saving cache.`); + core.info(`${cacheHit}: Cache hit occurred on the primary key ${primaryKey}, not saving cache.`); return; } try { diff --git a/src/cache.ts b/src/cache.ts index d81df17e..a61804fa 100644 --- a/src/cache.ts +++ b/src/cache.ts @@ -136,16 +136,15 @@ export async function save(id: string) { // Inputs are re-evaluated before the post action, so we want the original key used for restore const primaryKey = core.getState(STATE_CACHE_PRIMARY_KEY); - const cacheHitString = core.getState(STATE_CACHE_HIT); - const cacheHit = Boolean(cacheHitString); + const cacheHit = core.getState(STATE_CACHE_HIT); if (!primaryKey) { core.warning('Error retrieving key from state.'); return; - } else if (cacheHit) { + } else if (!!cacheHit) { // no change in target directories core.info( - `${cacheHitString}: Cache hit occurred on the primary key ${primaryKey}, not saving cache.` + `${cacheHit}: Cache hit occurred on the primary key ${primaryKey}, not saving cache.` ); return; }