Auto-Merge Pull Requests on Approval

This listener will automatically merge the pull request when the condition provided evaluates to true. It will only do this if can be merged with no conflicts, and no merge checks veto the merge. In other words, if it can be merged from the Bitbucket UI, it will do the merge.

The examples contain some sample conditions, such as:

  • A senior developer has approved

  • At least two reviewers have approved

A pull request can be automatically merged when every reviewer has approved it by creating a listener similar to the following one:

  1. Add a Name to describe what the listener does.
  2. Select the Projects/Repositories you want to work with.

  3. Enter your Condition by writing code within the script editor. You also have the option to click Example Scripts and copy code from a selection of relevant script examples. If Condition is left blank, the field evaluates to True

  4. Check to automatically delete the branch after the pull request has been merged successfully.
  5. Select Add to save the listener.