Fix cache-hit state boolean cast

This commit is contained in:
rak
2025-03-18 22:58:58 +01:00
parent 65a31a6cfe
commit 2875322ba9
3 changed files with 9 additions and 12 deletions

View File

@@ -96664,15 +96664,14 @@ function save(id) {
const packageManager = findPackageManager(id); const packageManager = findPackageManager(id);
// Inputs are re-evaluated before the post action, so we want the original key used for restore // 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 primaryKey = core.getState(STATE_CACHE_PRIMARY_KEY);
const cacheHitString = core.getState(STATE_CACHE_HIT); const cacheHit = core.getState(STATE_CACHE_HIT);
const cacheHit = Boolean(cacheHitString);
if (!primaryKey) { if (!primaryKey) {
core.warning('Error retrieving key from state.'); core.warning('Error retrieving key from state.');
return; return;
} }
else if (cacheHit) { else if (!!cacheHit) {
// no change in target directories // 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; return;
} }
try { try {

7
dist/setup/index.js vendored
View File

@@ -131913,15 +131913,14 @@ function save(id) {
const packageManager = findPackageManager(id); const packageManager = findPackageManager(id);
// Inputs are re-evaluated before the post action, so we want the original key used for restore // 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 primaryKey = core.getState(STATE_CACHE_PRIMARY_KEY);
const cacheHitString = core.getState(STATE_CACHE_HIT); const cacheHit = core.getState(STATE_CACHE_HIT);
const cacheHit = Boolean(cacheHitString);
if (!primaryKey) { if (!primaryKey) {
core.warning('Error retrieving key from state.'); core.warning('Error retrieving key from state.');
return; return;
} }
else if (cacheHit) { else if (!!cacheHit) {
// no change in target directories // 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; return;
} }
try { try {

View File

@@ -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 // 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 primaryKey = core.getState(STATE_CACHE_PRIMARY_KEY);
const cacheHitString = core.getState(STATE_CACHE_HIT); const cacheHit = core.getState(STATE_CACHE_HIT);
const cacheHit = Boolean(cacheHitString);
if (!primaryKey) { if (!primaryKey) {
core.warning('Error retrieving key from state.'); core.warning('Error retrieving key from state.');
return; return;
} else if (cacheHit) { } else if (!!cacheHit) {
// no change in target directories // no change in target directories
core.info( 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; return;
} }