Skip to content

Conversation

@LalatenduMohanty
Copy link
Member

Add a new Mergify rule to automatically rebase approved PRs when the base branch (main) is updated. This keeps PRs current with the latest code and ensures tests run on the actual merge result.

The rebase happens automatically when:

  • PR is not a draft
  • PR has no merge conflicts
  • PR is still open
  • PR has at least 1 approval from maintainers

Benefits:

  • Prevents stale PRs that fall behind main
  • Catches integration issues early
  • Ensures tests run on latest codebase
  • Maintains cleaner linear commit history

The rebase rule is placed before the auto-merge rule to ensure PRs are up-to-date before automatic merging occurs.

@LalatenduMohanty LalatenduMohanty requested a review from a team as a code owner October 29, 2025 16:08
@mergify mergify bot added the mergify label Oct 29, 2025
- "-draft"
- "-conflict"
- "-closed"
- "#approved-reviews-by>=1"
Copy link
Member

Choose a reason for hiding this comment

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

I think this rule is going to conflict with the one we have that causes MRs to merge when they are approved.

Copy link
Member Author

Choose a reason for hiding this comment

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

@dhellmann Along with this change we need to do the following
If you want to force a specific update method, you need to configure it in your GitHub repository settings:
Go to: Repository Settings → General → Pull Requests
Look for: "Allow merge commits" / "Allow squash merging" / "Allow rebase merging"
Set your preferred default

Copy link
Member

Choose a reason for hiding this comment

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

Ok, but I don't think we want to rebase on merge. We want to force the tests to run against the code either merged against main or rebased against main.

Add a new Mergify rule to automatically rebase approved PRs when the
base branch (main) is updated. This keeps PRs current with the latest
code and ensures tests run on the actual merge result.

The rebase happens automatically when:
- PR is not a draft
- PR has no merge conflicts
- PR is still open
- PR has at least 1 approval from maintainers

Benefits:
- Prevents stale PRs that fall behind main
- Catches integration issues early
- Ensures tests run on latest codebase
- Maintains cleaner linear commit history

The rebase rule is placed before the auto-merge rule to ensure PRs
are up-to-date before automatic merging occurs.

Signed-off-by: Lalatendu Mohanty <lmohanty@redhat.com>
@LalatenduMohanty LalatenduMohanty changed the title chore(mergify): add automatic rebase rule for approved PRs chore(mergify): Trigger automatic update rule for approved PRs Oct 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants