Skip to content

Commit 5784f44

Browse files
authored
Merge pull request #8 from ReactSphere/copilot/remove-bot-and-agents-leaderboard
Remove bots and agents from contributor leaderboard
2 parents fe5ebfa + f951ca8 commit 5784f44

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

profile/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ Browse issues labeled **`good first issue`** across our repos to get started.
5858
| Rank | Avatar | Username | Total | Commits | PRs | Issues | Reviews | Docs |
5959
|------|--------|----------|------:|--------:|----:|------:|--------:|----:|
6060
| 🥇 | <img src="https://avatars.githubusercontent.com/u/191262736?v=4" width="32"/> | [@naheel0](https://github.com/naheel0) | **83** | 39 | 11 | 0 | 10 | 23 |
61-
| 🥈 | <img src="https://avatars.githubusercontent.com/in/1143301?v=4" width="32"/> | [@Copilot](https://github.com/Copilot) | **39** | 22 | 11 | 0 | 0 | 6 |
62-
| 🥉 | <img src="https://avatars.githubusercontent.com/u/225665919?v=4" width="32"/> | [@jaseel0](https://github.com/jaseel0) | **27** | 12 | 0 | 0 | 8 | 7 |
63-
| 4 | <img src="https://avatars.githubusercontent.com/in/15368?v=4" width="32"/> | [@github-actions[bot]](https://github.com/github-actions[bot]) | **8** | 4 | 0 | 0 | 0 | 4 |
61+
| 🥈 | <img src="https://avatars.githubusercontent.com/u/225665919?v=4" width="32"/> | [@jaseel0](https://github.com/jaseel0) | **27** | 12 | 0 | 0 | 8 | 7 |
62+
| 3 | - | - | - | - | - | - | - | - |
63+
| 4 | - | - | - | - | - | - | - | - |
6464
| 5 | - | - | - | - | - | - | - | - |
6565
| 6 | - | - | - | - | - | - | - | - |
6666
| 7 | - | - | - | - | - | - | - | - |

profile/scripts/updateReadme.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ async function getAllPages(apiPath) {
4747
return results;
4848
}
4949

50+
function isBot(user) {
51+
if (!user) return false;
52+
if (user.type === 'Bot') return true;
53+
if (user.login && user.login.endsWith('[bot]')) return true;
54+
return false;
55+
}
56+
5057
async function main() {
5158
if (!TOKEN) {
5259
console.error('GIT_PAT is not set');
@@ -63,6 +70,7 @@ async function main() {
6370
try {
6471
const contribs = await getAllPages(`/repos/${ORG}/${repo.name}/contributors`);
6572
for (const c of contribs) {
73+
if (isBot(c)) continue;
6674
if (!contributors[c.login]) {
6775
contributors[c.login] = {
6876
login: c.login,
@@ -86,6 +94,7 @@ async function main() {
8694
if (!pr.merged_at) continue;
8795
const login = pr.user && pr.user.login;
8896
if (!login) continue;
97+
if (isBot(pr.user)) continue;
8998
if (!contributors[login]) {
9099
contributors[login] = {
91100
login,
@@ -109,6 +118,7 @@ async function main() {
109118
if (issue.pull_request) continue;
110119
const login = issue.user && issue.user.login;
111120
if (!login) continue;
121+
if (isBot(issue.user)) continue;
112122
if (!contributors[login]) {
113123
contributors[login] = {
114124
login,

0 commit comments

Comments
 (0)