Move cache save to runs.post and exit early (#60)
This commit is contained in:
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.");
|
||||
}
|
||||
}
|
||||
})();
|
||||
Reference in New Issue
Block a user