Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion scripts/collect-contributors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const HELPFUL_REACTIONS_THRESHOLD = 3
const HELPFUL_COMMENTS_THRESHOLD = 5
const OUTPUT_FILE = resolve(fileURLToPath(new URL('../public/contributors.json', import.meta.url)))
const USER_AGENT = 'nuxters-contributor-collector'
const KNOWN_BOT_ACCOUNTS = ['codecov-io', 'codecov-commenter']

type PullRequestType = 'docs' | 'chore' | 'feat' | 'fix'

Expand Down Expand Up @@ -69,7 +70,7 @@ const isBotAccount = (login: string | null | undefined) => {
if (!login) {
return true
}
return login.includes('[bot]') || login.endsWith('-bot')
return KNOWN_BOT_ACCOUNTS.includes(login) || login.includes('[bot]') || login.endsWith('-bot') || login === 'ghost'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Normalize login before bot matching.

The checks are case-sensitive right now, so mixed-case bot/fallback logins can slip through contributor counting.

Suggested fix
 const isBotAccount = (login: string | null | undefined) => {
   if (!login) {
     return true
   }
-  return KNOWN_BOT_ACCOUNTS.includes(login) || login.includes('[bot]') || login.endsWith('-bot') || login === 'ghost'
+  const normalizedLogin = login.toLowerCase()
+  return KNOWN_BOT_ACCOUNTS.includes(normalizedLogin)
+    || normalizedLogin.includes('[bot]')
+    || normalizedLogin.endsWith('-bot')
+    || normalizedLogin === 'ghost'
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return KNOWN_BOT_ACCOUNTS.includes(login) || login.includes('[bot]') || login.endsWith('-bot') || login === 'ghost'
const isBotAccount = (login: string | null | undefined) => {
if (!login) {
return true
}
const normalizedLogin = login.toLowerCase()
return KNOWN_BOT_ACCOUNTS.includes(normalizedLogin)
|| normalizedLogin.includes('[bot]')
|| normalizedLogin.endsWith('-bot')
|| normalizedLogin === 'ghost'
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/collect-contributors.ts` at line 73, Normalize the contributor login
before matching by creating a normalized variable (e.g., const normalizedLogin =
(login || '').toLowerCase().trim()) and use that in the bot checks instead of
raw login; compare KNOWN_BOT_ACCOUNTS against normalizedLogin (either ensure
KNOWN_BOT_ACCOUNTS entries are lowercase or use KNOWN_BOT_ACCOUNTS.some(a =>
a.toLowerCase() === normalizedLogin)) and replace login.includes('[bot]'),
login.endsWith('-bot') and login === 'ghost' with
normalizedLogin.includes('[bot]'), normalizedLogin.endsWith('-bot') and
normalizedLogin === 'ghost'.

}

const upsertContributor = (user: { login: string | null, id: number | null } | null | undefined) => {
Expand Down