Repository navigation
Fix Copilot author detection in mergify rules - #155
Conversation
Make Copilot author matching case-insensitive and add explicit author=Copilot match for the Copilot coding agent. This prevents PRs authored by Copilot with no file changes from being auto-closed. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
📝 WalkthroughWalkthroughUpdated the Mergify configuration to refine how Copilot-authored pull requests are detected. Changed from generic regex patterns to explicit author matching and case-insensitive body pattern checks for more precise identification. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 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 |
|
Important Cloud Posse Engineering Team Review RequiredThis pull request modifies files that require Cloud Posse's review. Please be patient, and a core maintainer will review your changes. To expedite this process, reach out to us on Slack in the |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.github/mergify.yml (1)
47-49:author~=(?i).*copilot.*supersedes the two explicitauthor=conditions above it.Mergify leverages Python regular expressions to match rules, and
(?i)is a supported inline modifier in Python regex, so line 49 is syntactically valid. However, since(?i).*copilot.*matches any username that contains "copilot" in any case, it fully subsumes bothauthor=github-copilot[bot](line 47) andauthor=Copilot(line 48) — making those two explicit entries redundant within thisorblock.Two minor follow-on points worth considering:
Overbreadth:
(?i).*copilot.*would also exempt any future account whose login merely contains the word "copilot" (e.g.my-copilot-helper) from the no-changes auto-close rule. If stricter matching is preferred, anchoring the pattern (e.g.(?i)^(github-)?copilot(\[bot\])?$) would limit the exemption to known Copilot identities only.Redundancy cleanup (optional): If the broad regex is intentional, the two explicit
author=lines can be removed for brevity.♻️ Option A — Keep explicit entries, narrow the fallback regex (preferred)
is_copilot_author: &is_copilot_author or: - "author=github-copilot[bot]" - "author=Copilot" - - "author~=(?i).*copilot.*" + - "author~=(?i)^(github-)?copilot(\[bot\])?$" - "body~=(?i)Co-authored-by:.*copilot"♻️ Option B — Remove redundant explicit entries, keep broad regex as-is
is_copilot_author: &is_copilot_author or: - - "author=github-copilot[bot]" - - "author=Copilot" - "author~=(?i).*copilot.*" - "body~=(?i)Co-authored-by:.*copilot"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/mergify.yml around lines 47 - 49, The three author entries ("author=github-copilot[bot]", "author=Copilot", and "author~=(?i).*copilot.*") conflict because the broad regex supersedes the two explicit matches; fix by either removing the two explicit lines if you intend to keep the broad exemption, or (preferred) keep the explicit "author=github-copilot[bot]" and "author=Copilot" lines and replace the broad "author~=(?i).*copilot.*" pattern with a narrower, case-insensitive anchored regex that only matches the known Copilot identities (i.e., optionally "github-" prefix, the literal "copilot", and an optional "[bot]" suffix) so the explicit entries remain meaningful and future similar usernames aren’t unintentionally exempted.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In @.github/mergify.yml:
- Around line 47-49: The three author entries ("author=github-copilot[bot]",
"author=Copilot", and "author~=(?i).*copilot.*") conflict because the broad
regex supersedes the two explicit matches; fix by either removing the two
explicit lines if you intend to keep the broad exemption, or (preferred) keep
the explicit "author=github-copilot[bot]" and "author=Copilot" lines and replace
the broad "author~=(?i).*copilot.*" pattern with a narrower, case-insensitive
anchored regex that only matches the known Copilot identities (i.e., optionally
"github-" prefix, the literal "copilot", and an optional "[bot]" suffix) so the
explicit entries remain meaningful and future similar usernames aren’t
unintentionally exempted.
what
author=Copilotmatch for the Copilot coding agent(?i)flag for case-insensitive regex matchingwhy
Copilot(capital C), but the regex.*copilot.*was case-sensitive and didn't matchreferences
Summary by CodeRabbit