setup-bun/src/cache-save.ts
Okinea Dev 7c641390eb
chore: add settings for vscode (#120)
* chore: update Prettier settings and add settings for vscode

* rollback semi

* fix: exclude `dist` from search and lock changes to some files

* Added `search.exclude` to ignore `dist/**` during searches.
* Configured `files.readonlyInclude` to lock changes to `dist/**`, `bun.lock`, and `package-lock.json`.
2025-07-08 15:29:27 +02:00

18 lines
542 B
TypeScript

import { saveCache } from "@actions/cache";
import { getState, warning } from "@actions/core";
import { CacheState } from "./action";
import { createHash } from "node:crypto";
(async () => {
const state: CacheState = JSON.parse(getState("cache"));
if (state.cacheEnabled && !state.cacheHit) {
const cacheKey = createHash("sha1").update(state.url).digest("base64");
try {
await saveCache([state.bunPath], cacheKey);
process.exit(0);
} catch (error) {
warning("Failed to save Bun to cache.");
}
}
})();