chore: add known bot accounts to contributor check#398
Conversation
|
@freb97 is attempting to deploy a commit to the Nuxt Team on Vercel. A member of the Team first needs to authorize it. |
📝 WalkthroughWalkthroughThis PR extends the bot account detection logic in the contributor collection script. A new Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
scripts/collect-contributors.tsOops! Something went wrong! :( ESLint: 10.2.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/.nuxt/eslint.config.mjs' imported from /eslint.config.mjs Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with 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.
Inline comments:
In `@scripts/collect-contributors.ts`:
- 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'.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: fe0adf8e-817d-4433-9fc8-c554bfb6e4ac
📒 Files selected for processing (1)
scripts/collect-contributors.ts
| return true | ||
| } | ||
| return login.includes('[bot]') || login.endsWith('-bot') | ||
| return KNOWN_BOT_ACCOUNTS.includes(login) || login.includes('[bot]') || login.endsWith('-bot') || login === 'ghost' |
There was a problem hiding this comment.
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.
| 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'.
🔗 Linked issue
Resolves #393
📚 Description
Adds a simple check for known bot accounts. I went through the first ~3k nuxters and didn't find any more than the 2 codecov bots but maybe a list makes sense here should any more pop up. Also adds a check for the github 'ghost' account.