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

10
dist/restore/index.js vendored
View File

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

View File

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