Merge Pull Request API is not overriding merge strategy

Issue #16784 new
Mark Cerezo
staff created an issue


Using PR merge API doesn't enforce or overrides the "merge_strategy" field, the API follows the default merge strategy set in the repository settings. To add, the API doesn't also overrides the "message" field.

Merge API:

How to reproduce

  1. Change your repository default merge strategy (under your repository > settings) to "Merge commit"
  2. Create a new Pull request
  3. Use the API CURL command below to merge (using "squash") your PR by providing the PR ID Sample CURL command:
curl --request POST \
  --url \
  --header 'authorization: Basic <HASH>' \
  --header 'cache-control: no-cache' \
  --header 'content-type: application/json' \
  --data '{
    "pullrequest_merge_parameters": {
        "type": "pullrequest",
        "message": "Sample commit message",
        "close_source_branch": "false",
        "merge_strategy": "squash"

Expected Results

The merge API should overrides / enforce the "merge_strategy" to "squash" the commit set in the API

Actual Results

The merge API is using the default merge strategy set in the repository settings


For now, we can manually set the merge strategy in repository settings to change

Comments (2)

  1. Rajendra Kumar

    Also the commit message sent in the curl is not overriding the default commit message added by api. Can we change the priority of this jira and get this fixed asap ? As we are adding automation around this for the whole company and due to this issue it is corrupting the commit messages and merge strategies from the automation.

  2. Ajaya Agrawal

    @Mark Cerezo There are multiple issues here.

    • merge_strategy field not being honored.
    • message field not being honored

    While there is a work-around for the first problem, there is no work-around for the second problem. Could please provide an ETA for the second problem? Independent of the fix, please change your documentation so that other users don't end up discovering the same problem again independently.

  3. Log in to comment