-
Notifications
You must be signed in to change notification settings - Fork 66
ci: enable automatic merging of pull requests #3585
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
Conversation
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
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. |
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. |
I'm pretty happy with the approach we currently have, there are no delays in Also, somewhat nitpicking - I like if "Committer: " value != bot account. Then there are often situations when somebody reviews, and since we are not in hurry and we don't merge immediately - another team member has a chance to review even after more than 24 hours (once merged, nobody reviews). Note though that this is an opinion of just one team-member, others may feel differently, so let's give them a chance to speak. |
We discussed this yesterday on the team meeting; summary is that the team seems to be for this change. I see no benefits, just risks, and path to a code-quality decrease (maybe maintenance problems). I'm confident with my 👎 vote, sorry. One of the ideas was to have a rule of "at least two reviewers", would that be possible? @nikromen promised to make a proper review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I say let's try it and see, mayble we'll like it, maybe not :D but yup let's discuss this on planing
Thank you Pavel for the feedback.
The labels could be disabled if you don't find them useful.
This is new to me. I have never used sorting by recently updated, but I will try to improve this so it won't touch PRs that frequently. |
PR that meets the following criteria will be automatically merged:
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:
on: push
workflows - https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow/cc @xsuchy