Skip to content
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

ci: enable automatic merging of pull requests #3585

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jamacku
Copy link

@jamacku jamacku commented Jan 15, 2025

PR that meets the following criteria will be automatically merged:

  • Passing CI
  • Approved by at least one reviewer
  • No Draft or WIP title
  • No conflicts

The merging workflow runs on schedule every 45 minutes. It can be executed manually on demand from the Actions tab. It internally uses several GitHub Actions to perform the merge.


I have tested the workflow on jamacku#1

A working example can be found at redhat-plumbers/systemd-rhel10#45 (comment). It contains a few more pieces, but merging logic is also present.


There are a few limitations/requirements:

/cc @xsuchy

PR that meets the following criteria will be automatically merged:

- Passing CI
- Approved by at least one reviewer
- No Draft or WIP title
- No conflicts

Merging workflow is running on schedule every 45 minutes.
It can be executed manually on demand from the Actions tab.
It internally uses several GitHub Actions to perform the merge.

- https://github.com/redhat-plumbers-in-action/gather-pull-request-metadata to gather PR metadata
- https://github.com/redhat-plumbers-in-action/pull-request-validator to check reviews and CI status
- https://github.com/redhat-plumbers-in-action/auto-merge to perform the merge
- https://github.com/redhat-plumbers-in-action/issue-commentator to comment on PRs about the merge status
@mfocko
Copy link
Contributor

mfocko commented Jan 15, 2025

Just out of interest, what's the reason for using GH Action instead of the GitHub's built-in functionality?

At the same time, from the reviewer's PoV, if I review the PR and click on the big green button denoting merge when ready, it has basically the same effect, cause in the branch protection rules I can require specific CI checks to pass, and also there cannot be any merge conflicts.

@jamacku
Copy link
Author

jamacku commented Jan 16, 2025

Just out of interest, what's the reason for using GH Action instead of the GitHub's built-in functionality?

This is a valid question. We (rhel systemd) had this automation before GitHub introduced all the Auto-merge stuff. We have other automation pieces related to Jira and Upstream that work together with auto-merge functionality. It allows us to have more customization and flexibility regarding the behavior. For example, we can waive the CI, all CI checks block us, and we pick non-blocking checks; when PR is merged, we transition Jira into a new state, etc.

For the copr project, it might be sufficient to use rules and auto-merge. But I know the copr project has a policy about merging approved PRs only after 24 hours from submission. This is currently not possible by using only rules. It is currently not possible by our action either, but it can be easily extended to support this requirement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants