Work in progress one click away: meet our Pull Request Merger
At Cloudaper, we use a simple trick that really eases the development and review process and we decided to share it with the world.
It's called Pull Request Merger and it's an open source Ruby gem you can simply use from the console.

Our workflow at Cloudaper is simple. We have a development environment, which runs on our servers and is available to anyone for testing. But the key is it always contains the latest work-in-progress features. At one place, with no need to pull or run anything locally.
This is extremely helpful not only because you can try the features from separate pull request all together, but also because anyone, including designers or managers, can see (and review) the current state of work just by opening the app in the browser.
PR Merger also uses GitHub statuses so that you can see in the PR whether the merge was successful or not.
How to use it?
- First, you need Ruby and the gem installed (
gem install pr-merger
). - Then generate a Personal access token on GitHub.
- Make sure the machine you are using has access to the repository.
- And run the PR Merger with appropriate arguments.
The assembled command looks like this:
pr-merger --access-token 2a3a8f5315a3435a295091a365d5f9fb736d84 --base-repo "cloudaper/pr-merger" --base-branch master --merge-branch merged-prs
If you don't want a specific pull request to merge, just add [skip merge]
after the title.
Look at our GitHub repository for more detailed documentation.
Put it into your CI
This is where this tool is strong. Add PR Merger to your CI process, run tests and/or deploy the current work in progress to the development environment.
The idea is simple: before running the actual CI steps, run the PR Merger. Here is our example configuration for Wercker, but you can make an analogy for any other CI service.
merge-prs:
box: ruby
steps:
- add-ssh-key:
name: Add GitHub deploy key
keyname: GITHUB_DEPLOY_KEY
- add-to-known_hosts:
name: Add github.com to known_hosts
hostname: github.com
- script:
name: Config Git user
code: |
git config user.name "$GIT_USER_NAME"
git config user.email "$GIT_USER_EMAIL"
- script:
name: Install pr-merger gem
code: |
gem install pr-merger
- script:
name: Merge all open PRs
code: |
pr-merger --access-token $GITHUB_TOKEN --base-repo "$WERCKER_GIT_OWNER/$WERCKER_GIT_REPOSITORY" --base-branch master --merge-branch merged-prs
Current limitations
However, there are some limitations. First, read the repository documentation regarding possible security risks.
Also, this is working only for GitHub-hosted repositories. However, it shouldn't be that hard to adjust the gem for usage with Bitbucket or GitLab, so feel free to open a pull request :)
And there will be conflicts. This means that in extreme cases, only one of all PRs will be merged. The PR Merger currently isn't very smart and can merge only branches that have no conflicts. But we plan to look into this so that PR Merger solves simple conflicts and merges as many branches as possible.
We hope that teams all around the world will find this simple tool useful and make their workflow even more efficient. And we're looking for your comments or even contributions!