mirror of
https://github.com/oven-sh/setup-bun.git
synced 2025-04-12 08:06:42 +08:00
Update cache-save.ts
This commit is contained in:
parent
b9d34de66d
commit
68fd46c4a3
@ -1,12 +1,17 @@
|
|||||||
import { saveCache } from "@actions/cache";
|
import { saveCache } from "@actions/cache";
|
||||||
import { getState, warning } from "@actions/core";
|
import { getState, warning } from "@actions/core";
|
||||||
import { CacheState } from "./action";
|
import { CacheState } from "./action";
|
||||||
|
import { createHash } from "node:crypto";
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
const state: CacheState = JSON.parse(getState("cache"));
|
const state: CacheState = JSON.parse(getState("cache"));
|
||||||
if (state.cacheEnabled && !state.cacheHit) {
|
if (state.cacheEnabled && !state.cacheHit) {
|
||||||
|
const cacheKey = createHash('sha1')
|
||||||
|
.update(state.url)
|
||||||
|
.digest('base64')
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await saveCache([state.bunPath], state.url);
|
await saveCache([state.bunPath], cacheKey);
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
warning("Failed to save Bun to cache.");
|
warning("Failed to save Bun to cache.");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user