This commit is contained in:
Jozef Steinhübl 2026-01-04 23:19:49 +01:00
parent b67f026fc2
commit 466b8e41d2
No known key found for this signature in database
GPG Key ID: 8D9A5E4549AA84FD
2 changed files with 2 additions and 21 deletions

View File

@ -16,7 +16,7 @@ import { getExecOutput } from "@actions/exec";
import { Registry } from "./registry"; import { Registry } from "./registry";
import { writeBunfig } from "./bunfig"; import { writeBunfig } from "./bunfig";
import { saveState } from "@actions/core"; import { saveState } from "@actions/core";
import { addExtension, retry } from "./utils"; import { addExtension } from "./utils";
import { DownloadMeta, getDownloadMeta } from "./download-url"; import { DownloadMeta, getDownloadMeta } from "./download-url";
import { cwd } from "node:process"; import { cwd } from "node:process";
@ -110,11 +110,7 @@ export default async (options: Input): Promise<Output> => {
if (!cacheHit) { if (!cacheHit) {
info(`Downloading a new version of Bun: ${url}`); info(`Downloading a new version of Bun: ${url}`);
// TODO: remove this, temporary fix for https://github.com/oven-sh/setup-bun/issues/73 revision = await downloadBun(downloadMeta, bunPath);
revision = await retry(
async () => await downloadBun(downloadMeta, bunPath),
3,
);
} }
} }

View File

@ -3,21 +3,6 @@ import { info } from "node:console";
import { existsSync, readFileSync, renameSync } from "node:fs"; import { existsSync, readFileSync, renameSync } from "node:fs";
import { resolve, basename } from "node:path"; import { resolve, basename } from "node:path";
export function retry<T>(
fn: () => Promise<T>,
retries: number,
timeout = 10000,
): Promise<T> {
return fn().catch((err) => {
if (retries <= 0) {
throw err;
}
return new Promise((resolve) => setTimeout(resolve, timeout)).then(() =>
retry(fn, retries - 1, timeout),
);
});
}
export async function request( export async function request(
url: string, url: string,
init?: RequestInit, init?: RequestInit,