Skip to content

chore: add known bot accounts to contributor check#398

Open
freb97 wants to merge 1 commit into
nuxt:mainfrom
freb97:patch-1
Open

chore: add known bot accounts to contributor check#398
freb97 wants to merge 1 commit into
nuxt:mainfrom
freb97:patch-1

Conversation

@freb97

@freb97 freb97 commented May 17, 2026

Copy link
Copy Markdown

🔗 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.

@vercel

vercel Bot commented May 17, 2026

Copy link
Copy Markdown

@freb97 is attempting to deploy a commit to the Nuxt Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented May 17, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR extends the bot account detection logic in the contributor collection script. A new KNOWN_BOT_ACCOUNTS constant array is introduced to list specific GitHub bot accounts, and the isBotAccount function is updated to check if a login is in this list. This change ensures that codecov-io and codecov-commenter accounts are excluded from contributor statistics, complementing the existing bot-pattern detection that filters accounts with [bot] or -bot suffixes.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding known bot accounts to the contributor check logic.
Description check ✅ Passed The description is related to the changeset, explaining that it adds checks for known bot accounts including codecov bots and the GitHub ghost account.
Linked Issues check ✅ Passed The PR implements filtering for known bot accounts (codecov-io, codecov-commenter) and the GitHub ghost account as requested in issue #393.
Out of Scope Changes check ✅ Passed All changes are in-scope: the addition of bot account filtering directly addresses the requirements specified in issue #393 with no extraneous modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

scripts/collect-contributors.ts

Oops! Something went wrong! :(

ESLint: 10.2.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/.nuxt/eslint.config.mjs' imported from /eslint.config.mjs
at finalizeResolution (node:internal/modules/esm/resolve:271:11)
at moduleResolve (node:internal/modules/esm/resolve:861:10)
at defaultResolve (node:internal/modules/esm/resolve:988:11)
at #cachedDefaultResolve (node:internal/modules/esm/loader:697:20)
at #resolveAndMaybeBlockOnLoaderThread (node:internal/modules/esm/loader:714:38)
at ModuleLoader.resolveSync (node:internal/modules/esm/loader:746:52)
at #resolve (node:internal/modules/esm/loader:679:17)
at ModuleLoader.getOrCreateModuleJob (node:internal/modules/esm/loader:599:35)
at ModuleJob.syncLink (node:internal/modules/esm/module_job:162:33)
at ModuleJob.link (node:internal/modules/esm/module_job:252:17)


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between fac8e10 and afcfc30.

📒 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'

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'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Discussion: Filter fallback accounts

1 participant