/gomerge

Gomerge is a tool which allows you to quickly bulk merge and approve several pull requests from your terminal.

Primary LanguageGo

gomerge

GitHub Actions Status GitHub Actions Status Downloads

Gomerge logo

Description

Gomerge is a tool to quickly enable you to bulk merge and/or approve Github pull requests from your terminal. The intention of this tool is to simplfy merging large numbers of Github pull requests, as they can certainly grow when you're maintaining a large number of repositories (Ahem, dependabot!). This tool should be able to run on most systems.

Requirements

You must have created a github personal access token (PAT) to use this tool. For information on how to do so, you can follow the documentation https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token

Gomerge Demo

Install

To install the latest version via homebrew, please run the following.

brew tap Cian911/gomerge
brew install gomerge

// Check the binary is working as expected.
gomerge -h

To install the compiled binary, you can go to the releases tab, and download the version most suitable to your environment. An example of such is below.

wget https://github.com/Cian911/gomerge/releases/download/2.1.1/gomerge_2.1.1_Linux_x86_64.tar.gz
sudo tar -xvf gomerge_2.1.1_Linux_x86_64.tar.gz -C /usr/local/bin/
sudo chmod +x /usr/local/bin/gomerge
Upgrade

If you have the tool installed already via homebrew, you can upgrade by running the following:

brew upgrade gomerge

Usage

Below denotes the available commands and flags on the gomerge tool.

Gomerge makes it simple to merge an open pull request from your terminal.

Usage:
  gomerge [command]

Available Commands:
  help        Help about any command
  list        List all open pull request for a repository you wish to merge.
  version     Prints the current version and build information.

Flags:
  -a, --approve               Pass an optional approve flag as an argument which will only approve and not merge selected repos.
  -c, --config string         Pass an optional config file as an argument with list of repositories.
  -h, --help                  help for gomerge
  -m, --merge-method string   Pass an optional merge method for the pull request (merge [default], squash, rebase).
  -r, --repo string           Pass name of repository as argument (organization/repo).
  -t, --token string          Pass your github personal access token (PAT).

Use "gomerge [command] --help" for more information about a command.

To get a list of open and active pull requests for a given repo, you can run the following command. Note, this will list all available PRs for merging, if you want to just approve a list of PRs, then add the -a to the below command too.

N.B: Please ensure to add your organization followed by the name of your repository. In most cases this will be your github username, but if referencing a repository that exists within an organization you have access to, be sure to substitute it for that E.G google/example-repo.

gomerge list -r Cian911/gomerge -t ${GITHUB_TOKEN}

If there are any active and open pull requests for your given repository, you will see an output similar to below.

gomerge Sample Output

From here, follow the instructions to select which pull request you wish to merge, and hit enter. Your pull request should now have been merged, and you should get a similar message to below.

PR #3: Pull Request successfully merged.
Bulk Merging/Approving Pull Requests

You should first create a config.yaml file in the following format.

organization: Cian911
repositories:
- pr-test
- syncwave

You can then run the tool like so, passing the config file as a flag.

gomerge list -t $GITHUB_TOKEN -c config.yaml

And again, if you just wish to approve a list of available PRs, just add the -a flag like so.

gomerge list -t $GITHUB_TOKEN -c config.yaml -a

You should see a list of active and open pull requets from the repositories you have defined in your configuration file.

gomerge Bulk Output Sample