mirror of
https://github.com/web3privacy/web
synced 2024-10-15 18:26:27 +02:00
49 lines
1.3 KiB
JavaScript
49 lines
1.3 KiB
JavaScript
import "https://deno.land/std@0.206.0/dotenv/load.ts";
|
|
|
|
const contributorRepos = [
|
|
|
|
// main repos
|
|
"web3privacy/web3privacy",
|
|
"web3privacy/data",
|
|
"web3privacy/docs",
|
|
"web3privacy/web",
|
|
|
|
// explorer
|
|
"web3privacy/explorer",
|
|
"web3privacy/explorer-data",
|
|
"web3privacy/explorer-app",
|
|
|
|
// old - deprecated
|
|
"web3privacy/events",
|
|
"web3privacy/w3ps1",
|
|
"web3privacy/grants",
|
|
]
|
|
|
|
async function getContributors () {
|
|
const output = [];
|
|
for (const cr of contributorRepos) {
|
|
const response = await fetch(`https://api.github.com/repos/${cr}/contributors`, {
|
|
//headers: {
|
|
// "Authorization": `Token ${Deno.env.get('GITHUB_TOKEN')}`
|
|
//}
|
|
});
|
|
const arr = await response.json();
|
|
for (const item of arr) {
|
|
if (item.login === "github-actions[bot]") {
|
|
continue;
|
|
}
|
|
|
|
const found = output.find(i => i.login === item.login)
|
|
if (!found) {
|
|
output.push(item)
|
|
} else {
|
|
found.contributions += item.contributions
|
|
}
|
|
}
|
|
}
|
|
return output.sort((x, y) => y.contributions > x.contributions ? 1 : -1);
|
|
}
|
|
|
|
const contributors = await getContributors()
|
|
await Deno.writeTextFile("./src/contributors.json", JSON.stringify(contributors, null, 2))
|
|
console.log(`File ./src/contributors.json saved`)
|