You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
TRaSH-Guides/.github/scripts/update-contributors-backup.js

39 lines
1014 B

8 months ago
const axios = require('axios');
const fs = require('fs');
8 months ago
let contributors = [];
8 months ago
let page = 1;
function fetchPage() {
axios.get(`https://api.github.com/repos/FonduemangVI/Guides/contributors?per_page=100&page=${page}`)
.then((response) => {
if (response.data.length === 0) {
// No more contributors, write the file
8 months ago
fs.writeFileSync('CONTRIBUTORS.json', JSON.stringify(contributors, null, 2));
8 months ago
return;
}
response.data.forEach((user) => {
// Exclude bots and actions-user
if (user.type === 'Bot' || user.login.toLowerCase().includes('bot') || user.login === 'actions-user') return;
8 months ago
const userJson = {
"title": user.login,
"image": user.avatar_url,
"url": user.html_url,
};
8 months ago
8 months ago
contributors.push(userJson);
8 months ago
});
// Fetch the next page
page++;
fetchPage();
})
.catch((error) => {
console.error(`Could not fetch contributors: ${error}`);
});
}
8 months ago
fetchPage();