Automating Merges and Updates with Bulldozer

When doing trunk-based development, you often have to deal with the issue of keeping your branch up-to-date with the master or main branch. The last thing you want to rely on is everyone having to manually update their branches - any friction point in development that can be automated should be, so developers can get back to doing the work they love best.

The company Palantir has produced an open-source project called Bulldozer that can do this for you. At ACV, we setup a container that runs Bulldozer and connected to our build systems, so that access to our repositories would remain internal. For smaller projects or for public repositories, it says you can add Bulldozer directly to your repo as a Github App, but we were unable to find it.

In short, Bulldozer automates things like merging pull requests, updating pull requests, and looking at status checks and labels so it doesn’t do things when it’s not supposed to. You just need to add a simple configuration YAML file to the repository, and most of the settings have common-sense default values.

Here is a sample YAML file from one of our repos:

version: 1

    labels: ["do not merge"]
  method: squash
  delete_after_merge: true

    labels: ["do not update"]

As you can see, there are two main sections: one for merging, and one for updating. The ignore lists tell Bulldozer to not merge or update if those conditions match. One catch is that merging is the default, so merging will happen unless you specify that it shouldn’t, whereas updating will not happen unless you add the update section to the configuration. Also, in case there is a merge conflict, Bulldozer will wait for the developer to resolve it before doing anything.

Check out the official repo here.