new: Add cache base warmup strategy. (#16)

This commit is contained in:
Miles Johnson 2023-11-17 10:27:56 -08:00 committed by GitHub
parent c15c42022b
commit c91b4202a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 177 additions and 86 deletions

View file

@ -3,7 +3,14 @@ import { saveCache } from './src/cargo';
async function run() {
try {
await saveCache();
const base = core.getInput('cache-base');
// Only save the cache for the following 2 scenarios:
// - If not using the base warmup strategy.
// - If using the base warmup strategy, and the current ref matches.
if (!base || (base && !!(process.env.GITHUB_REF_NAME ?? '').match(base))) {
await saveCache();
}
} catch (error: unknown) {
core.setFailed((error as Error).message);
}