I am attempting to use the Azure DevOps Services REST API to set the PR Completion Options to enforce a squash merge on a Pull Request.
Note: I can't set a branch policy to enforce a squash merge as I am testing certain conditions to see if a squash merge is required or not and attempting to enforce a squash as if the branch policy is set for that PR only.
When I make the following call:
PATCH https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/pullrequests/{pullRequestId}?api-version=5.0
{
"completionOptions": {
"squashMerge": true
}
}
The response shows the value is set
Yet when attempting to complete the request, I would expect the "Squash changes when merging" checkbox to be ticked and disabled.
If I leave the form as-is and complete the merge, no squash is performed.
If I set bypassPolicy
to true, I still see no difference in completion options.
So in summary, I know that the call is successful as the response is coming back with the options set, but the changes don't seem to be coming through to the Pull Request in Azure DevOps.