MCPcopy Create free account
hub / github.com/api-platform/website / getAllContributors

Function getAllContributors

pwa/api/contributorsRank.ts:63–188  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

61});
62
63export const getAllContributors = async () => {
64 const contributors: Contributor[] = [];
65
66 try {
67 const REPOSITORIES_TO_IGNORE = ["symfonycon-berlin-workshop-eod"];
68
69 const result = await octokit.rest.repos.listForOrg({
70 org: "api-platform",
71 });
72 if (result.status !== 200) throw "oups";
73 const { data } = result;
74
75 const repositories = [
76 ...data
77 .map((repository) => ({ owner: "api-platform", repo: repository.name }))
78 .filter(({ repo }) => !REPOSITORIES_TO_IGNORE.includes(repo)),
79 { owner: "dunglas", repo: "mercure" },
80 { owner: "dunglas", repo: "vulcain" },
81 ];
82
83 await Promise.all(
84 repositories.map(async ({ repo, owner }) => {
85 const repositoryContributors = await octokit.paginate(
86 octokit.rest.repos.listContributors as any,
87 {
88 owner,
89 repo,
90 per_page: 100,
91 }
92 );
93
94 repositoryContributors.forEach((contributor: Contributor) => {
95 const existingContributor = contributors.find(
96 (c) => c.login === contributor.login
97 );
98 if (existingContributor) {
99 existingContributor.contributions += contributor.contributions;
100 existingContributor.repos.push({
101 repo,
102 contributions: contributor.contributions,
103 url: `https://github.com/${owner}/${repo}`,
104 });
105 } else {
106 contributors.push({
107 ...contributor,
108 repos: [
109 {
110 repo,
111 contributions: contributor.contributions,
112 url: `https://github.com/${owner}/${repo}`,
113 },
114 ],
115 rank: 0,
116 });
117 }
118 });
119 })
120 );

Callers 2

getContributorsFunction · 0.90
getContributorsFunction · 0.90

Calls 1

addHttpsToUrlsFunction · 0.85

Tested by

no test coverage detected