3
0
Fork 0
mirror of https://github.com/Swatinem/rust-cache synced 2026-02-10 20:54:33 +00:00

avoid error when saving without git dependencies

This commit is contained in:
Arpad Borsos 2020-10-13 13:52:55 +02:00
parent 5f6034beb8
commit 292ef23e77
5 changed files with 302 additions and 183 deletions

View file

@ -1,6 +1,6 @@
import * as cache from "@actions/cache";
import * as core from "@actions/core";
import { getCacheConfig, isValidEvent, stateKey } from "./common";
import { cleanTarget, getCacheConfig, getPackages, isValidEvent, stateKey } from "./common";
async function run() {
if (!isValidEvent()) {
@ -23,6 +23,13 @@ async function run() {
} 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}`);
}