2023-11-13 03:03:34 +01:00
|
|
|
import "https://deno.land/std@0.206.0/dotenv/load.ts";
|
|
|
|
|
|
|
|
const contributorRepos = [
|
2024-01-25 23:45:59 +01:00
|
|
|
|
|
|
|
// main repos
|
2023-11-13 03:03:34 +01:00
|
|
|
"web3privacy/web3privacy",
|
2024-01-25 23:45:59 +01:00
|
|
|
"web3privacy/data",
|
2024-01-25 19:38:01 +01:00
|
|
|
"web3privacy/docs",
|
2024-01-25 23:45:59 +01:00
|
|
|
"web3privacy/web",
|
2024-01-26 03:08:54 +01:00
|
|
|
"web3privacy/brand",
|
|
|
|
|
|
|
|
// events workgroup
|
|
|
|
"web3privacy/events",
|
2024-01-25 23:45:59 +01:00
|
|
|
|
|
|
|
// explorer
|
2023-12-20 23:14:44 +01:00
|
|
|
"web3privacy/explorer",
|
|
|
|
"web3privacy/explorer-data",
|
2024-01-25 23:45:59 +01:00
|
|
|
"web3privacy/explorer-app",
|
|
|
|
|
|
|
|
// old - deprecated
|
|
|
|
"web3privacy/w3ps1",
|
|
|
|
"web3privacy/grants",
|
2024-01-26 03:08:54 +01:00
|
|
|
"web3privacy/old-website",
|
|
|
|
"web3privacy/web3privacy-app-old",
|
|
|
|
|
2023-11-13 03:03:34 +01:00
|
|
|
]
|
|
|
|
|
|
|
|
async function getContributors () {
|
|
|
|
const output = [];
|
|
|
|
for (const cr of contributorRepos) {
|
|
|
|
const response = await fetch(`https://api.github.com/repos/${cr}/contributors`, {
|
2023-11-24 10:56:28 +01:00
|
|
|
//headers: {
|
|
|
|
// "Authorization": `Token ${Deno.env.get('GITHUB_TOKEN')}`
|
|
|
|
//}
|
2023-11-13 03:03:34 +01:00
|
|
|
});
|
|
|
|
const arr = await response.json();
|
|
|
|
for (const item of arr) {
|
2024-01-26 00:20:08 +01:00
|
|
|
if (item.login === "github-actions[bot]") {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2023-11-13 03:03:34 +01:00
|
|
|
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`)
|