How We Stopped Merging Pull Requests

This post was updated at February 2021 with fresh know-how.
What is new?

From Kodiak to native GitHub Auto-merge


What comes before merging a pull request? Code-review, feedback from developers, and fixes to make the reviewer happy. After that, we only need the tests, coding standard, PHPStan, and Rector to pass in the CI.

Here is an idea - don't merge any pull-request from now on...

...and let them opened for ages... no, just kidding.

Don't forget to Merge

But if you already accepted the pull-request, the issues are resolved, you still have to wait for CI to finish with green. If you're lucky, it's under 3 minutes, if you're open source 5-8 minutes and with private project 5-30 minutes.

How to kill the waiting time? Go for a coffee, toilet break, or a social leak (Facebook, Twitter, or your favorite PHP blog), get back, see the green checkbox, and click on the merge button. Or even worse - you jump to another issue, remember to merge, then switch your focus back and forth...

The instant feedback is killed, and so is the flow.

"**Can you automate** responsibility developers have to think about?
Just do it!
They will be able to focus more and produce better quality code."

Wait for 240 pull-requests a Month? No, Thanks!

In Rector and Symplify mono-repositories we had 240 merge-request for just last month.

That's 240 distractions with ~5 minutes upkeep = 20 hours wasted by brain-waiting and much more work ruined.

Delegate and Automate Merge Request

What if I told you just a few percent of these manually? The rest is done by GitHub Auto-merge.

How does GitHub Auto-merge work? You mark the pull-request with the "automerge" tag, then - if CI passes - the pull-request is merged. So instead of waiting 240 times for CI feedback, you'll add the tag when you finish the review. Then the pull-request is closed, and you can focus on the next work in the peace.

4 Steps to Setup Auto-Merge

1. Go to Setting of your GitHub Repository

2. Add Branch Checks for master

3. Select Jobs that are Required to Pass

4. Enable GitHub Auto-merge

Go to your project settings, e.g. https://github.com/symplify/symplify/settings


Now GitHub is enabled and waiting for your work!

1 Step to Automerge Pull-Request with GitHub

Is your PR ready? Go down and enable the automerge:

GitHub waits for the CI to pass and then merges and deletes branch:


Now you've one less to think about for the rest of your life.


Happy coding!




Do you learn from my contents or use open-source packages like Rector every day?
Consider supporting it on GitHub Sponsors. I'd really appreciate it!