3
0
Fork 0
mirror of https://github.com/Swatinem/rust-cache synced 2025-04-05 21:24:07 +00:00

only pre-clean when something was restored

This commit is contained in:
Arpad Borsos 2020-10-13 14:01:46 +02:00
parent 292ef23e77
commit 9de90d2338
2 changed files with 12 additions and 12 deletions

View file

@ -54800,16 +54800,16 @@ async function run() {
if (restoreKey) {
core.info(`Restored from cache key "${restoreKey}".`);
core.saveState(stateKey, restoreKey);
}
else {
core.info("No cache found.");
}
if (restoreKey !== key) {
// pre-clean the target directory on cache mismatch
const packages = await getPackages();
await cleanTarget(packages);
}
}
else {
core.info("No cache found.");
}
}
catch (e) {
core.info(`[warning] ${e.message}`);
}

View file

@ -20,9 +20,6 @@ async function run() {
if (restoreKey) {
core.info(`Restored from cache key "${restoreKey}".`);
core.saveState(stateKey, restoreKey);
} else {
core.info("No cache found.");
}
if (restoreKey !== key) {
// pre-clean the target directory on cache mismatch
@ -30,6 +27,9 @@ async function run() {
await cleanTarget(packages);
}
} else {
core.info("No cache found.");
}
} catch (e) {
core.info(`[warning] ${e.message}`);
}