MCPcopy Create free account
hub / github.com/pollinations/pollinations / fetchContributors

Function fetchContributors

apps/gsoc/src/api/githubContri.ts:17–51  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

15
16 useEffect(() => {
17 const fetchContributors = async () => {
18 try {
19 const response = await fetch(
20 "https://api.github.com/repos/pollinations/pollinations/contributors?per_page=10",
21 {
22 headers: {
23 Accept: "application/vnd.github.v3+json",
24 },
25 },
26 );
27
28 if (!response.ok) {
29 throw new Error(`API error: ${response.status}`);
30 }
31
32 const data = await response.json();
33 const filtered = Array.isArray(data)
34 ? data
35 .filter(
36 (c: GitHubContributor) =>
37 !c.login.includes("[bot]") &&
38 !c.login.includes("dependabot"),
39 )
40 .slice(0, 10)
41 : [];
42 setContributors(filtered);
43 setError(null);
44 } catch (err) {
45 console.error("Error fetching contributors:", err);
46 setError(err instanceof Error ? err.message : "Unknown error");
47 setContributors([]);
48 } finally {
49 setLoading(false);
50 }
51 };
52
53 fetchContributors();
54 }, []);

Callers 1

useTopContributorsFunction · 0.85

Calls 4

jsonMethod · 0.80
sliceMethod · 0.80
errorMethod · 0.80
fetchFunction · 0.50

Tested by

no test coverage detected