use hardcoded community mirror list when ziglang.org is inaccessible
This commit is contained in:
@@ -51,14 +51,31 @@ 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 = [];
|
||||
let mirrors;
|
||||
try {
|
||||
// Fetch an up-to-date list of available 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 inaccessible. As a fallback (so that ziglang.org outages don't break
|
||||
// this Action), use a hardcoded mirror list. This was manually fetched from ziglang.org, and I
|
||||
// expect that at least some of these mirrors will continue working. It only needs to be updated
|
||||
// if the upstream list changes *significantly*.
|
||||
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",
|
||||
"https://ziglang.freetls.fastly.net",
|
||||
"https://zig.tilok.dev",
|
||||
"https://zig-mirror.tsimnet.eu/zig",
|
||||
"https://zig.karearl.com/zig",
|
||||
"https://pkg.earth/zig",
|
||||
"https://fs.liujiacai.net/zigbuilds",
|
||||
];
|
||||
}
|
||||
|
||||
core.info(`Available mirrors: ${mirrors.join(", ")}`);
|
||||
|
||||
Reference in New Issue
Block a user