3
0
Fork 0
mirror of https://github.com/Swatinem/rust-cache synced 2026-03-20 15:15:51 +00:00

initial commit

This commit is contained in:
Arpad Borsos 2020-09-25 16:42:39 +02:00
commit 99970e092c
No known key found for this signature in database
GPG key ID: 908EDF65263368B4
12 changed files with 111031 additions and 0 deletions

35
src/restore.ts Normal file
View file

@ -0,0 +1,35 @@
import * as cache from "@actions/cache";
import * as core from "@actions/core";
import { getCaches, isValidEvent } from "./common";
async function run() {
if (!isValidEvent()) {
return;
}
try {
core.exportVariable("CARGO_INCREMENTAL", 0);
const caches = await getCaches();
for (const [name, { path, key, restoreKeys }] of Object.entries(caches)) {
try {
core.startGroup(`Restoring "${path}" from "${key}"…`);
const restoreKey = await cache.restoreCache([path], key, restoreKeys);
if (restoreKey) {
core.info(`Restored "${path}" from cache key "${restoreKey}".`);
core.saveState(name, restoreKey);
} else {
core.info("No cache found.");
}
} catch (e) {
core.info(`[warning] ${e.message}`);
} finally {
core.endGroup();
}
}
} catch (e) {
core.info(`[warning] ${e.message}`);
}
}
run();