fix: auto assign is not working correctly#220
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR broadens the auto-assign matching logic and updates tests to exercise multiple checkbox templates.
- Refactored
isWillingToSubmitPRto match any “submit a pull request” checkbox, not just a specific text. - Added
issueBodieshelper andAPI_URLconstant in tests; replaced manual mocks with loops over generated bodies. - Updated expectations to reference the new
API_URL.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/plugins/auto-assign/index.js | Introduce API_URL, add issueBodies helper, and loop tests over multiple bodies |
| src/plugins/auto-assign/index.js | Relax substring match in isWillingToSubmitPR for broader coverage |
Comments suppressed due to low confidence (4)
tests/plugins/auto-assign/index.js:19
- [nitpick] The constant
API_URLis quite generic—consider renaming it to something likeASSIGNEES_API_URLto clarify its purpose.
const API_URL = "https://api.github.com/repos/test/repo-test/issues/1/assignees";
tests/plugins/auto-assign/index.js:55
- [nitpick] Hardcoding the full repository path in tests can be brittle; consider deriving this URL dynamically (e.g., from a base constant or repo metadata) to keep tests flexible.
fetchMock.mockGlobal().post(API_URL,
tests/plugins/auto-assign/index.js:26
- [nitpick] Consider adding a test scenario for an uppercase checkbox mark (
[X]) to verify that your matching logic handles case-insensitive checkboxes correctly.
function issueBodies(checkMark) {
src/plugins/auto-assign/index.js:28
- Using a broad
includescheck may produce false positives; consider switching to a regex with start-of-line anchoring (e.g.,/^- \[x\] i am willing to submit a pull request/i) for more precise matching.
.includes(
"- [x] i am willing to submit a pull request"
);
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hello,
Currently, the new feature auto-assign works only for specific checkbox comments, so some issue templates cannot
benefit from the automation.
So, I've fixed the auto-assign plugin properly to make it work for all of the repositories.
Here are some real-world examples:
Real World Examples
Markdown
CSS
JSON
eslint.org
eslint
rewrite
code-explorer