Terminate build in CI if download fails

This commit is contained in:
Sidharth Vinod
2023-07-06 21:36:10 +05:30
parent d4281d365d
commit bcffff3b7b

View File

@@ -19,6 +19,10 @@ async function download(url: string, fileName: URL) {
await writeFile(fileName, Buffer.from(await image.arrayBuffer())); await writeFile(fileName, Buffer.from(await image.arrayBuffer()));
} catch (error) { } catch (error) {
console.error('failed to load', url, error); console.error('failed to load', url, error);
// Exit the build process if we are in CI
if (process.env.CI) {
throw error;
}
} }
} }
@@ -32,7 +36,7 @@ async function fetchAvatars() {
download(`https://github.com/${name}.png?size=100`, getAvatarPath(name)); download(`https://github.com/${name}.png?size=100`, getAvatarPath(name));
}); });
await Promise.all(avatars); await Promise.allSettled(avatars);
} }
fetchAvatars(); fetchAvatars();