mirror of
https://github.com/actions/setup-node.git
synced 2025-04-24 12:22:12 +00:00
feat(cache) use restoreKeys as backup to hit cache
Fixes
This commit is contained in:
parent
41acaa2e85
commit
49141160ec
1 changed files with 3 additions and 1 deletions
|
@ -37,11 +37,13 @@ export const restoreCache = async (
|
||||||
}
|
}
|
||||||
|
|
||||||
const primaryKey = `node-cache-${platform}-${packageManager}-${fileHash}`;
|
const primaryKey = `node-cache-${platform}-${packageManager}-${fileHash}`;
|
||||||
|
const restoreKeys = [`node-cache-${platform}-${packageManager}-`];
|
||||||
core.debug(`primary key is ${primaryKey}`);
|
core.debug(`primary key is ${primaryKey}`);
|
||||||
|
core.debug(`restore keys are [${restoreKeys}]`);
|
||||||
|
|
||||||
core.saveState(State.CachePrimaryKey, primaryKey);
|
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));
|
core.setOutput('cache-hit', Boolean(cacheKey));
|
||||||
|
|
||||||
if (!cacheKey) {
|
if (!cacheKey) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue