mirror of
https://github.com/oven-sh/setup-bun.git
synced 2025-07-19 13:08:27 +02:00
Move cache save to runs.post and exit early (#60)
This commit is contained in:
parent
12944059f7
commit
0f37bd8169
6 changed files with 139 additions and 44 deletions
15
src/cache-save.ts
Normal file
15
src/cache-save.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
import { saveCache } from "@actions/cache";
|
||||
import { getState, warning } from "@actions/core";
|
||||
import { CacheState } from "./action";
|
||||
|
||||
(async () => {
|
||||
const state: CacheState = JSON.parse(getState("cache"));
|
||||
if (state.cacheEnabled && !state.cacheHit) {
|
||||
try {
|
||||
await saveCache([state.bunPath], state.url);
|
||||
process.exit(0);
|
||||
} catch (error) {
|
||||
warning("Failed to save Bun to cache.");
|
||||
}
|
||||
}
|
||||
})();
|
Loading…
Add table
Add a link
Reference in a new issue