How We Stopped Merging Pull Requests

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?
Please 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 Kodiak. That's not my full-time on-demand coworker, but Github Application that handles automated merging.

How does Kodiak 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 Kodiak

1. Go to Setting of your GitHub Repository

2. Add Branch Checks for master

3. Select Jobs that are Required to Pass

4. Enable Kodiak

Go to marketplace and enable it.

5. Add .kodiak.toml Setup To the Repository code

# .kodiak.toml
version = 1

# this saves deleting merged branches manually
merge.delete_branch_on_merge = true

Now Kodiak is enabled and waiting for your work!

1 Step to Automerge Pull-Request with Kodiak

1. After You Decide the PR is Ready, add the "automerge" tag

Then you're finished. The Kodiak will handle the rest...

Kodiak waits for the CI to pass...

...then merges and deletes branch:

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

Happy coding!