feat(cache) use restoreKeys as backup to hit cache

Fixes
This commit is contained in:
Matthijs van der Burgh 2022-11-17 13:26:26 +01:00
parent 41acaa2e85
commit 49141160ec

View file

@ -37,11 +37,13 @@ export const restoreCache = async (
}
const primaryKey = `node-cache-${platform}-${packageManager}-${fileHash}`;
const restoreKeys = [`node-cache-${platform}-${packageManager}-`];
core.debug(`primary key is ${primaryKey}`);
core.debug(`restore keys are [${restoreKeys}]`);
core.saveState(State.CachePrimaryKey, primaryKey);
const cacheKey = await cache.restoreCache([cachePath], primaryKey);
const cacheKey = await cache.restoreCache([cachePath], primaryKey, restoreKeys);
core.setOutput('cache-hit', Boolean(cacheKey));
if (!cacheKey) {