Skip to content

Commit 9dddef5

Browse files
authored
Merge pull request #7 from ReactSphere/leaderboard
Implement user filtering for leaderboard
2 parents 52bc64e + ff95f09 commit 9dddef5

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

.github/scripts/generate-leaderboard.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,19 @@ const fs = require('fs');
2525
// ---------------------------------------------------------------------------
2626
// Configuration
2727
// ---------------------------------------------------------------------------
28+
// Ignore bots and AI agents
29+
function isIgnoredUser(login) {
30+
if (!login) return true;
31+
32+
// ignore github bots
33+
if (login.endsWith("[bot]")) return true;
34+
35+
// ignore AI agents
36+
const ignored = ["Copilot"];
37+
if (ignored.includes(login)) return true;
38+
39+
return false;
40+
}
2841
const ORG = process.env.ORG || 'ReactSphere';
2942
const TOKEN = process.env.GITHUB_TOKEN;
3043
const OUTPUT_FILE = process.env.OUTPUT_FILE || 'LEADERBOARD.md';
@@ -217,6 +230,10 @@ async function fetchDocCommits(repo) {
217230
// ---------------------------------------------------------------------------
218231

219232
function ensureUser(map, login, avatarUrl) {
233+
234+
// 🚫 Skip bots and AI
235+
if (isIgnoredUser(login)) return;
236+
220237
if (!map[login]) {
221238
map[login] = {
222239
login,
@@ -228,7 +245,7 @@ function ensureUser(map, login, avatarUrl) {
228245
documentation: 0,
229246
};
230247
}
231-
// Keep the avatar URL if we discover it later
248+
232249
if (avatarUrl && map[login].avatarUrl.endsWith('.png')) {
233250
map[login].avatarUrl = avatarUrl;
234251
}

0 commit comments

Comments
 (0)