Uploaded image for project: 'Bitbucket Cloud'
  1. Bitbucket Cloud
  2. BCLOUD-22055

Merging pull request via API does not honor auto-merge branch permission setting

    XMLWordPrintable

Details

    Description

      Issue Summary

      Currently, if you have the "Allow automatic merge when builds pass" branch permission checked when you merge a PR on the UI, it will wait for the last build to be passed before the PR is merged.
      However, if you use the API 2.0 endpoint below to merge the PR, it does not wait for the last build to be passed, it will merge the PR straightaway.

      POST /2.0/repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}/merge
      

      API Reference: https://developer.atlassian.com/cloud/bitbucket/rest/api-group-pullrequests/#api-repositories-workspace-repo-slug-pullrequests-pull-request-id-merge-post

      Steps to Reproduce

      1. Use the branch permission "Allow automatic merge when builds pass" in a pull request's destination branch
      2. Create a pull request (or use an existing one)
      3. While using BB Pipelines (with "sleep" command to have some time to merge), push a commit to the source branch
      4. While the build is running, use the API 2.0 endpoint above to merge the pull request

      Expected Results

      The API will wait for the last build to be passed before merging the pull request (or possibly run it asynchronously)

      Actual Results

      The pull request was merged without waiting for the last build to be passed

      Workaround

      Currently, there is no known workaround for this behavior. A workaround will be added here when available

      Attachments

        Activity

          People

            Unassigned Unassigned
            mcerezo Mark C
            Votes:
            5 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: