Skip to content

Mergery

GitHub App

Mergery

GitHub App

Automatically merges pull requests labelled automerge when the merge button becomes green.

Screenshot

Screen Shot 2023-02-10 at 17 34 41

Behaviour

Mergery reacts to the following events:

  • PR review approved
  • PR labelled with automerge
  • Commit statuses and checks complete

When the above events happen, PRs that meet both the following conditions are merged:

  • The PR is labelled with automerge (case-insensitive)
  • The merge button is green

The conditions for the merge button being green depend on your repository configuration. If the merge button is enabled but grey, Mergery will not merge the PR.

Non-bot PRs merged to public repos are tooted.

Merge Strategy

GitHub allows merge strategies to be specified per repository. Mergery attempts the following merge strategies in order until successful:

  1. Squash
  2. Rebase
  3. Merge

If you don't want Mergery to use a specific merge strategy, please make sure that strategy is disabled in your repository settings.

Required Permissions

The permissions this app requires and the reasons it requires them are as follows:

  • Read access to checks, commit statuses, issues, and metadata
    • To be notified when commit statuses and checks are complete
    • To be able to search for PRs that are related to a successful commit status
  • Read and write access to code/content and pull requests
    • To be notified when a PR is labelled (read)
    • To be notified when a PR is approved (read)
    • To be able to commit to the target branch when merging PRs (write)
    • To be able to close the PR when merging (write)*
  • Read and write access to workflows
    • To be able to merge pull requests that modify files in the .github/workflows directory.

FAQ

Why use this instead of GitHub's native auto-merge feature?

  1. GitHub's version merges the pull request when all required checks are complete. Mergery only merges the pull request when the merge button is green. In other words, GitHub will merge while non-required checks are still running, Mergery will not.
  2. GitHub's version only allows auto-merge to be enabled when the PR is blocked by merge requirements. For Mergery, there are no requirements for adding the automerge label.
  3. Mergery is enabled via adding a label to the PR. Github's auto-merge feature must either be manually enabled per pull-request, or done so via the GraphQL API. Apps that have not added support for GitHub's auto-merge via the GraphQL API, but that do support adding labels to PRs, will work with Mergery but not GitHub's native feature.
  4. GitHub's version doesn't work in free private repositories, Mergery does.

This app was released in May 2020, months before GitHub announced they were implementing this feature natively.

Mergery merged a PR before CI started!

This can happen when automatically adding the automerge label at PR creation time when CI takes time to register new checks.

Mergery is very simple. If you add the automerge label and the merge button is green, Mergery will merge the PR. If you don't want it to merge the PR, don't add the label, or make sure the merge button is not green. I recommend that you add a branch protection rule with required status checks. This way the merge button will not be green before CI has started, and Mergery will not merge the PR until the CI has marked those checks as successful. Alternatively, add the automerge label as part of your CI workflow.

Can Mergery close linked issues?

No. Mergery does not require write permission to issues, so it is unable to close issues mentioned in PRs that use keywords such as closes.

This means that if Mergery merges a PR that uses keywords, any linked issues must be closed manually.

This is due to Github's design decision to separate the responsibility of the person linking the issue from the person closing the issue.

Contact the Developer

My email address is listed in the commits to the git repositories on my GitHub profile, or you can contact me on Mastodon.

Developer

Mergery is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

Report abuse