-
-
Notifications
You must be signed in to change notification settings - Fork 19
Exclude bot accounts (e.g. coderabbitai) from auto-assignment #104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
WalkthroughAdds utilities to detect human commenters and a guard in comment handling that blocks Changes
Sequence DiagramsequenceDiagram
participant GitHub as GitHub Event
participant Index as index.js
participant Utils as utils.js
participant Assign as Assignment Logic
GitHub->>Index: deliver comment event
Index->>Index: parse comment for /assign or /unassign
Index->>Utils: isHumanCommenter(comment)?
alt Human (User / Mannequin)
Utils-->>Index: true
Index->>Assign: proceed with assignment/unassignment
Assign-->>Index: operation result
Index-->>GitHub: respond/complete
else Non-human (Bot / App)
Utils-->>Index: false
Index->>Index: log guard message and return early
Index-->>GitHub: no assignment performed
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/mock-test.js`:
- Around line 490-497: Update the test data to use GitHub's actual bot account
type: change the appComment object's user.type from 'App' to 'Bot' in the mock
where appComment is defined (the block that builds appComment and asserts
isHumanCommenter(appComment) is false). Keep the existing assertions and
variable names (appComment, botComment) and ensure isHumanCommenter is still
called for both.
🧹 Nitpick comments (1)
src/mock-test.js (1)
453-467: Good test setup, but consider sharing the keywords constant.The
assignKeywordsarray is duplicated fromsrc/index.js. If the keywords are updated in the main file, these tests could become stale without anyone noticing.Consider exporting
assignKeywordsfrom a shared constants module or directly fromindex.jsto keep them in sync:// In a shared constants file or export from index.js module.exports = { assignKeywords, unassignKeywords }; // In tests const { assignKeywords } = require('../src/constants');
|
@coderabbitai Can you check if this PR covers everything from the PR #99 , also can you check if assigning to copilot is still possible as maintainer sometimes assigns copilot. |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 45761 🏁 Script executed: Length of output: 799
Coverage Comparison: PR
|
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 15107
File 1:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@TESTING.md`:
- Line 167: Update the summary table row that currently reads "| **Total** |
**17** | **✅** |" to reflect the correct total of 22 tests (i.e., change 17 to
22) so it matches the count stated on line 15 and includes the 5 new Human
Commenter Guard tests.
- Line 58: Replace the malformed header line "#### 8. (5 tests)" with a
properly formatted test-group header following the pattern used elsewhere, e.g.
"#### 8. Human Commenter Guard (5 tests)"; locate the header by searching for
the exact string "#### 8. (5 tests)" and update it to include the title "Human
Commenter Guard" and normalize spacing to match "#### N. Title (X tests)".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@TESTING.md`:
- Line 15: Update the summary line in TESTING.md that currently reads "Total: 22
tests across 6 categories" to reflect the correct number of categories (change
"6" to "8") so it matches the listed categories (Assignment Management, Label
Management, Giphy Integration, Kudos System, Command Detection, Attribution,
Error Handling, Human Commenter Guard); ensure the updated string remains
consistent with the document's formatting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@TESTING.md`:
- Line 15: Replace the emphasized summary line using a proper Markdown heading
to satisfy MD036; change the bold line "**Total: 22 tests across 8 categories**"
to an appropriate heading (e.g., "## Total: 22 tests across 8 categories") in
TESTING.md so the summary is a real heading instead of emphasis-as-heading.
|
@coderabbitai Can you check if all issues have fixed!? |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 53667 🏁 Script executed: Length of output: 1649
✅ Resolved Issues
❌ Remaining Issue (1)TESTING.md - MD036 linting violation: Line 15 and a few other lines use bold emphasis instead of proper Markdown headings, which violates the MD036 rule. Current (incorrect): **Total: 22 tests across 8 categories**Should be: ## Total: 22 tests across 8 categoriesQuick fix needed for these lines:
Once you convert these bold lines to proper headings, all issues will be resolved! 🎉 |
|
This document error is followed throughout the doc. All other issues have been fixed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!! also i think we only have /unassign command not any other phrases so some tests can be removed safely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@TESTING.md`:
- Around line 58-64: The header "#### 8. Human Commenter Guard (5 tests)" is
inconsistent with the actual four tests in the suite; update the header in
TESTING.md to "#### 8. Human Commenter Guard (4 tests)" so it matches the four
`it` blocks in src/mock-test.js (the Human Commenter Guard test suite), or
alternatively add the missing fifth `it` in src/mock-test.js if you intended
five tests—prefer the minimal fix of changing the header to (4 tests).
♻️ Duplicate comments (2)
TESTING.md (2)
15-15: Use a real heading instead of bold emphasis (MD036).✅ Proposed fix
-**Total: 21 tests across 8 categories** +#### Total: 21 tests across 8 categories
165-166: Summary table totals likely omit the tip test.
src/mock-test.jsincludes a “tip comment” test (lines 218-244) that isn’t reflected in the summary table, so the total of 21 may be undercounted. Consider adding a category row and updating totals, or explicitly folding that test into an existing category.📝 Example update (add Tip Requests row)
| Error Handling | 3 | ✅ | +| Tip Requests | 1 | ✅ | | Human Commenter Guard | 4 | ✅ | -| **Total** | **21** | **✅** | +| **Total** | **22** | **✅** |
Closes #98
This PR updates BLT-Action’s auto-assignment logic so that bot and GitHub App accounts are never assigned when they comment with /assign (or equivalent keywords). Only real user accounts (user.type === "User") can trigger assignment/unassignment now, which prevents tools like CodeRabbit from being auto-assigned to issues/PRs.
What’s changed
In the issue_comment handler, the action now checks the commenter’s user.type.
If the commenter is not a regular user (for example, type is Bot), the action logs a “Skipping /assign from non-user account” message and returns early.
This guarantees that bot or GitHub App comments cannot trigger self-assignment.
The same user.type === "User" check is applied in the unassignment path so that bots also cannot trigger unassignment commands.
This keeps behavior consistent between assignment and unassignment.
When a non-user account is skipped, the logs now include the login and account type.
This makes it obvious in the Actions logs why a /assign comment from a bot did not result in an assignment.
For normal GitHub users, behavior remains the same:
/assign still attempts to assign the commenter.
How this was tested
Local testing was done using act against a BLT fork with a small “Bounty Test” workflow that invokes BLT-Action on issue_comment events and passes a GitHub token via secrets.
Two event payloads were used:
Event JSON where comment.user.type is User.
The action processed the /assign comment and attempted to assign the human account to the issue, as expected.
Event JSON where comment.user.type is Bot and the login is coderabbitai.
The action processed the comment but logged a message indicating that it was skipping /assign for a non-user account, and did not attempt to call the GitHub API to add assignees.
This confirms that human users can still use /assign normally, while bot accounts are now safely ignored by the auto-assignment logic.
All existing validation and checks remain in place.
Summary by CodeRabbit
New Features
Tests
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.