···
22
22
23
23
while (true) {
24
24
const response = await fetch(
25
25
-
`https://api.github.com/repos/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}/contributors?per_page=100&page=${page}`,
25
25
+
`https://api.github.com/repos/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}/contributors?per_page=100&anon=1&page=${page}`,
26
26
{
27
27
headers: {
28
28
'Accept': 'application/vnd.github+json',
···
44
44
}
45
45
46
46
const data = allContributors.map((c: any) => ({
47
47
-
username: c.login,
48
48
-
avatarUrl: c.avatar_url,
47
47
+
username: c.login || c.name || 'anonymous',
48
48
+
avatarUrl: c.avatar_url || null,
49
49
contributions: c.contributions,
50
50
+
anonymous: c.type === 'Anonymous',
50
51
}));
51
52
52
53
return cors(req, new Response(JSON.stringify(data), {