Caching fix

This commit is contained in:
Nathan Ahn 2025-07-12 13:24:21 -04:00
parent 9b0a10bfca
commit 11022e311a
2 changed files with 28 additions and 25 deletions

46
dist/setup/index.js generated vendored

File diff suppressed because one or more lines are too long

View file

@ -80,12 +80,15 @@ export default async (options: Input): Promise<Output> => {
const cacheKeyBase = createHash("sha1").update(url).digest("base64") const cacheKeyBase = createHash("sha1").update(url).digest("base64")
const cacheKey = `${cacheKeyBase}-${options.extraKey ?? "default"}` const cacheKey = `${cacheKeyBase}-${options.extraKey ?? "default"}`
if (cacheEnabled) { if (cacheEnabled) {
const cacheRestored = await restoreCache([bunPath], cacheKey, [cacheKeyBase]); const cacheRestored = await restoreCache([bunPath, cachePath], cacheKey, [cacheKeyBase]);
if (cacheRestored) { if (cacheRestored) {
revision = await getRevision(bunPath); revision = await getRevision(bunPath);
if (revision) { if (revision) {
cacheHit = true;
info(`Using a cached version of Bun: ${revision}`); info(`Using a cached version of Bun: ${revision}`);
if(cacheRestored === cacheKey){
info(`Cache hit with key: ${cacheRestored}`);
cacheHit = true;
}
} else { } else {
warning( warning(
`Found a cached version of Bun: ${revision} (but it appears to be corrupted?)`, `Found a cached version of Bun: ${revision} (but it appears to be corrupted?)`,