Skip to content

ci(mergify): allow multi-segment branch names for dependabot - #456

Merged
CatherineSue merged 2 commits into
mainfrom
fix/temp-disable-branch-close
Feb 18, 2026
Merged

CatherineSue merged 2 commits into
mainfrom
fix/temp-disable-branch-close

Conversation

@CatherineSue

@CatherineSue CatherineSue commented Feb 18, 2026 •

Copy link
Copy Markdown
Member

Description

Problem

Dependabot PRs (e.g. dependabot/cargo/pyo3-0.28.1) use multi-segment branch names with more than one /, which the current branch naming regex rejects and auto-closes.

Solution

Update the regex to allow additional path segments by appending (/[a-z0-9._-]+)*.

Changes

  • Updated branch naming regex from ^[a-z0-9]([a-z0-9._-]*[a-z0-9])?/[a-z0-9._-]+$ to ^[a-z0-9]([a-z0-9._-]*[a-z0-9])?/[a-z0-9._-]+(/[a-z0-9._-]+)*$

Test Plan

  • Verified regex matches dependabot branches: dependabot/cargo/jsonwebtoken-10.3, dependabot/cargo/toml-1.0, dependabot/cargo/rustc-hash-2.1, dependabot/cargo/pyo3-0.28.1
  • Verified standard branches still pass: feat/add-auth, fix/null-pointer, changsu/fix-routing
  • Verified invalid branches still fail: main, mybranch, FEAT/something, feat/
Checklist
  • cargo +nightly fmt passes
  • cargo clippy --all-targets --all-features -- -D warnings passes
  • (Optional) Documentation updated

Summary by CodeRabbit

  • Chores
    • Renamed internal branch-naming enforcement rule and clarified it applies to internal branches.
    • Relaxed branch-name validation to allow multi-segment sub-paths (e.g., a/b/c) and updated guidance.
    • Added an additional compliant example format (e.g., dependabot/cargo/pyo3-0.28.1).
    • Noted that PRs with non-conforming branch names will be auto-closed; rule limited to this repository.

Update the branch naming regex to accept additional path segments
(e.g. dependabot/cargo/pyo3-0.28.1) so dependabot PRs are not
auto-closed.

Signed-off-by: Chang Su <chang.s.su@oracle.com>
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @CatherineSue, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves an issue where Mergify's branch naming convention was too restrictive, preventing automated Dependabot pull requests from being processed. By adjusting the regular expression in the Mergify configuration, the system can now correctly identify and accept branches with multiple path segments, ensuring that dependency updates from Dependabot are no longer inadvertently blocked.

Highlights

  • Mergify Configuration Update: The Mergify configuration file (.github/mergify.yml) has been updated to modify the branch naming convention regex.
  • Dependabot Branch Support: The updated regex now correctly recognizes and allows multi-segment branch names, specifically addressing an issue where Dependabot PRs were being rejected due to their branch naming structure (e.g., dependabot/cargo/pyo3-0.28.1).
  • Regex Enhancement: The branch naming regex was extended to include an optional group (/[a-z0-9._-]+)* at the end, enabling it to match branches with additional path segments while maintaining existing validation for standard branch names.
Changelog
  • .github/mergify.yml
    • Updated the branch naming convention regex to support multi-segment branch names, particularly for Dependabot branches.
Activity
  • No human activity has occurred on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@coderabbitai

coderabbitai Bot commented Feb 18, 2026 •

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

Renames a Mergify rule and tightens its scope; relaxes the branch-name regex to allow one-or-more sub-path segments; adds a repository-specific condition; updates user-facing messages and examples to note allowed sub-paths and that non-conforming PRs will be auto-closed.

Changes

Cohort / File(s) Summary
Mergify configuration
.github/mergify.yml
Renamed rule to "Enforce branch naming convention (internal)"; changed branch-name regex from requiring a single segment after the slash to allowing one-or-more /segment sub-paths; added head-repo-full-name = lightseekorg/smg condition; updated comment/message text and examples (adds dependabot/cargo/pyo3-0.28.1); clarified that non-conforming PRs will be auto-closed and that sub-paths like a/b/c are allowed.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • slin1237
  • XinyueZhang369

Poem

🐇 I munched on carrots, then fixed a rule,
Branches now wander, tidy but cool,
Slashes and segments can stretch and play,
Dependabot hops in — hip hooray! 🥕✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'ci(mergify): allow multi-segment branch names for dependabot' clearly summarizes the main change - updating the Mergify branch naming regex to support multi-segment branch names used by dependabot.
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
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/temp-disable-branch-close

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

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the branch naming convention regex in the Mergify configuration to support multi-segment branch names, which is necessary for Dependabot branches. The change correctly extends the regex to allow for additional segments, aligning with the guideline for permissive branch naming conventions. I've suggested a minor simplification to the regex to make it more concise and readable by using a + quantifier instead of repeating a pattern. Overall, the change is correct and well-tested.

Comment thread .github/mergify.yml Outdated

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/mergify.yml (1)

3-22: 🧹 Nitpick | 🔵 Trivial

Update user-facing guidance to reflect multi-segment branches.

The regex now accepts additional /segment parts, but the description and messages still imply exactly two segments. This can confuse users whose multi-segment branches are now valid.

Proposed wording update
-    description: Branch must follow <type>/<description> or <username>/<description> format
+    description: Branch must follow <type>/<description> or <username>/<description> format (description may include additional /segments)

@@
-          Please use one of the following formats:
-          - `<type>/<description>` — e.g. `feat/add-auth`, `fix/null-pointer`
-          - `<username>/<description>` — e.g. `changsu/fix-routing`
+          Please use one of the following formats:
+          - `<type>/<description>` — e.g. `feat/add-auth`, `fix/null-pointer`, `feat/api/auth`
+          - `<username>/<description>` — e.g. `changsu/fix-routing`, `dependabot/cargo/pyo3-0.28.1`

@@
-          Branch `{{head}}` does not match the required pattern: `<type>/<description>` or `<username>/<description>`.
+          Branch `{{head}}` does not match the required pattern: `<type>/<description>` or `<username>/<description>` (description may include `/`).
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/mergify.yml around lines 3 - 22, Update the user-facing text that
currently implies exactly two segments to reflect that the branch pattern allows
multiple slash-separated segments: modify the description, the comment.message
examples, and the post_check.summary to state that branches must be in the form
`<type>/<description...>` or `<username>/<description...>` (i.e., one or more
segments after the first slash), update examples to include multi-segment
branches like `feat/auth/add-2fa` or `changsu/fix/routing/edge-case`, and keep
the allowed types list and the conditions regex unchanged; change the
explanatory note to clarify that multi-segment branches are valid.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In @.github/mergify.yml:
- Around line 3-22: Update the user-facing text that currently implies exactly
two segments to reflect that the branch pattern allows multiple slash-separated
segments: modify the description, the comment.message examples, and the
post_check.summary to state that branches must be in the form
`<type>/<description...>` or `<username>/<description...>` (i.e., one or more
segments after the first slash), update examples to include multi-segment
branches like `feat/auth/add-2fa` or `changsu/fix/routing/edge-case`, and keep
the allowed types list and the conditions regex unchanged; change the
explanatory note to clarify that multi-segment branches are valid.

@CatherineSue
CatherineSue force-pushed the fix/temp-disable-branch-close branch 3 times, most recently from 5b79dcb to a4941ed Compare February 18, 2026 07:01
@github-actions github-actions Bot added the ci CI/CD configuration changes label Feb 18, 2026
…names

Split the branch naming rule into two: internal branches are still
auto-closed, while fork PRs only receive a friendly comment suggesting
the convention without blocking the contribution.

Signed-off-by: Chang Su <chang.s.su@oracle.com>
@CatherineSue
CatherineSue force-pushed the fix/temp-disable-branch-close branch from a4941ed to 57b115d Compare February 18, 2026 07:03
@CatherineSue
CatherineSue merged commit dc5d2d3 into main Feb 18, 2026
4 checks passed
@CatherineSue
CatherineSue deleted the fix/temp-disable-branch-close branch February 18, 2026 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci CI/CD configuration changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant