From 4a8cb08cd3aea0663c9c169ca66f7df842771016 Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Mon, 8 Sep 2025 17:23:52 -0700 Subject: [PATCH] use fallback community mirror list when ziglang.org is down --- main.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/main.js b/main.js index 7f06d55..085cef3 100644 --- a/main.js +++ b/main.js @@ -51,14 +51,23 @@ async function downloadTarball(tarball_filename) { return await downloadFromMirror(preferred_mirror, tarball_filename); } - // Fetch the list of mirrors from ziglang.org. Caching the mirror list is awkward in this context, - // so if the list is inaccessible, we just fetch from ziglang.org as a fallback. let mirrors = []; try { + // Fetch the list of mirrors from ziglang.org. const mirrors_response = await fetch(MIRRORS_URL); mirrors = (await mirrors_response.text()).split('\n').filter((url) => url.length != 0); } catch { - // For some reason the mirrors are inaccessible. That's okay; allow ourselves to fall back to ziglang.org below. + // ziglang.org itself is down. Use this backup list instead. + // Update this periodically to keep it in sync with the upstream community mirror list. + mirrors = [ + "https://pkg.machengine.org/zig", + "https://zigmirror.hryx.net/zig", + "https://zig.linus.dev/zig", + "https://zig.squirl.dev", + "https://zig.florent.dev", + "https://zig.mirror.mschae23.de/zig", + "https://zigmirror.meox.dev", + ]; } core.info(`Available mirrors: ${mirrors.join(", ")}`);