From 6e3ec0f06d22c8dd23e60ed1b65219a3aa587990 Mon Sep 17 00:00:00 2001 From: rak Date: Tue, 18 Mar 2025 23:08:20 +0100 Subject: [PATCH] Fix cache-hit state boolean cast --- dist/cleanup/index.js | 3 ++- dist/setup/index.js | 3 ++- src/cache.ts | 7 ++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/dist/cleanup/index.js b/dist/cleanup/index.js index 2325d641..9354d03b 100644 --- a/dist/cleanup/index.js +++ b/dist/cleanup/index.js @@ -96665,11 +96665,12 @@ function save(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 cacheHit = core.getState(STATE_CACHE_HIT); + core.info(`Cache-hit state: ${cacheHit}`); if (!primaryKey) { core.warning('Error retrieving key from state.'); return; } - else if (!!cacheHit) { + if (!!cacheHit || cacheHit !== 'false') { // no change in target directories core.info(`${cacheHit}: Cache hit occurred on the primary key ${primaryKey}, not saving cache.`); return; diff --git a/dist/setup/index.js b/dist/setup/index.js index 6035498c..bd76ac42 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -131914,11 +131914,12 @@ function save(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 cacheHit = core.getState(STATE_CACHE_HIT); + core.info(`Cache-hit state: ${cacheHit}`); if (!primaryKey) { core.warning('Error retrieving key from state.'); return; } - else if (!!cacheHit) { + if (!!cacheHit || cacheHit !== 'false') { // no change in target directories core.info(`${cacheHit}: Cache hit occurred on the primary key ${primaryKey}, not saving cache.`); return; diff --git a/src/cache.ts b/src/cache.ts index a61804fa..48cc2400 100644 --- a/src/cache.ts +++ b/src/cache.ts @@ -138,10 +138,15 @@ export async function save(id: string) { const primaryKey = core.getState(STATE_CACHE_PRIMARY_KEY); const cacheHit = core.getState(STATE_CACHE_HIT); + core.info( + `Cache-hit state: ${cacheHit}` + ); + if (!primaryKey) { core.warning('Error retrieving key from state.'); return; - } else if (!!cacheHit) { + } + if (!!cacheHit || cacheHit !== 'false') { // no change in target directories core.info( `${cacheHit}: Cache hit occurred on the primary key ${primaryKey}, not saving cache.`