diff --git a/site/scripts/get-contributors.js b/site/scripts/get-contributors.js index a17f4e4055..fe642e10e7 100644 --- a/site/scripts/get-contributors.js +++ b/site/scripts/get-contributors.js @@ -5,15 +5,26 @@ const Jimp = require('jimp'); process.chdir(__dirname); +const base = `https://api.github.com/repos/sveltejs/svelte/contributors`; +const { GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET } = process.env; + const SIZE = 64; async function main() { - const res = await fetch(`https://api.github.com/repos/sveltejs/svelte/stats/contributors?client_id=${process.env.GITHUB_CLIENT_ID}&client_secret=${process.env.GITHUB_CLIENT_SECRET}`); - const contributors = await res.json(); + const contributors = []; + let page = 1; + + while (true) { + const res = await fetch(`${base}?client_id=${GITHUB_CLIENT_ID}&client_secret=${GITHUB_CLIENT_SECRET}&per_page=100&page=${page++}`); + const list = await res.json(); + + if (list.length === 0) break; + + contributors.push(...list); + } const authors = contributors - .sort((a, b) => b.total - a.total) - .map(({ author }) => author); + .sort((a, b) => b.contributions - a.contributions); const sprite = new Jimp(SIZE * authors.length, SIZE);