Do not cache action releases

This commit is contained in:
Ashcon Partovi 2023-03-01 17:36:06 -08:00
parent 1c8c9a7615
commit 4573031972
2 changed files with 10 additions and 10 deletions

10
dist/setup.js vendored
View File

@ -60,14 +60,14 @@ function getDownloadUrl(options) {
}; };
} }
const release = encodeURIComponent(options?.version ?? "latest"); const release = encodeURIComponent(options?.version ?? "latest");
const os = options?.os ?? process.platform; const os = encodeURIComponent(options?.os ?? process.platform);
const arch = options?.arch ?? process.arch; const arch = encodeURIComponent(options?.arch ?? process.arch);
const avx2 = options?.avx2 ?? true; const avx2 = encodeURIComponent(options?.avx2 ?? true);
const profile = options?.profile ?? false; const profile = encodeURIComponent(options?.profile ?? false);
const { href } = new URL(`${release}/${os}/${arch}?avx2=${avx2}&profile=${profile}`, "https://bun.sh/download/"); const { href } = new URL(`${release}/${os}/${arch}?avx2=${avx2}&profile=${profile}`, "https://bun.sh/download/");
return { return {
url: href, url: href,
cacheKey: /^canary|latest$/i.test(release) cacheKey: /^latest|canary|action/i.test(release)
? null ? null
: `bun-${release}-${os}-${arch}-${avx2}-${profile}`, : `bun-${release}-${os}-${arch}-${avx2}-${profile}`,
}; };

View File

@ -80,17 +80,17 @@ function getDownloadUrl(options?: {
}; };
} }
const release = encodeURIComponent(options?.version ?? "latest"); const release = encodeURIComponent(options?.version ?? "latest");
const os = options?.os ?? process.platform; const os = encodeURIComponent(options?.os ?? process.platform);
const arch = options?.arch ?? process.arch; const arch = encodeURIComponent(options?.arch ?? process.arch);
const avx2 = options?.avx2 ?? true; const avx2 = encodeURIComponent(options?.avx2 ?? true);
const profile = options?.profile ?? false; const profile = encodeURIComponent(options?.profile ?? false);
const { href } = new URL( const { href } = new URL(
`${release}/${os}/${arch}?avx2=${avx2}&profile=${profile}`, `${release}/${os}/${arch}?avx2=${avx2}&profile=${profile}`,
"https://bun.sh/download/" "https://bun.sh/download/"
); );
return { return {
url: href, url: href,
cacheKey: /^canary|latest$/i.test(release) cacheKey: /^latest|canary|action/i.test(release)
? null ? null
: `bun-${release}-${os}-${arch}-${avx2}-${profile}`, : `bun-${release}-${os}-${arch}-${avx2}-${profile}`,
}; };