azure-rest-api-specs
azure-rest-api-specs copied to clipboard
createdBy value does not set Pull Request creator when using ADO Create Pull Request REST API
Hi, I'm not sure if this is the right place for this, but there seems to be a bug in the Create Pull Request REST API.
The Request Body section of the docs says that you can pass in a "CreatedBy" value when creating a PR. However, no matter what I pass here, the creator of the PR is always the person/account associated with the bearer token that is passed in the header. I think there is either a bug with the API, or the documentation is wrong. Could you provide clarity? The same thing seems to be true for the "autoCompleteSetBy" property. Here is an example of what I'm doing:
# Get PR created by someone else on my team
$getEndpoint = "https://dev.azure.com/$organization/_apis/git/pullrequests/$($pullRequestId)?api-version=4.1"
$examplePR = Invoke-RestMethod -Uri $getEndpoint-Method GET -Headers $header -ContentType application/json
# Use the IdentityRef from the example PR as the "createdBy" value in a new PR
$postEndpoint ="https://$organization.visualstudio.com/$project/_apis/git/repositories/$repoId/pullrequests?api-version=5.1"
$body = @{
createdBy = $examplePR.createdBy
sourceRefName= "refs/heads/mybranch"
targetRefName = "refs/heads/develop"
title = "Automated PR test"
}
Invoke-RestMethod -Uri $postEndpoint -Method POST -Headers $header -Body (ConvertTo-Json $body) -ContentType application/json
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @narula0781, @ashishonce, @romil07.
@narula0781, @ashishonce, @romil07, is there an update on this? I would like to use the CreatedBy field when creating the PR programmatically. I am creating the PR as part of an ADO build pipeline, and I would like to customize the PR so that it is created by the person who triggered the pipeline.
Any update on this? I'm in the same boat.
Same issue here, can we have an update please?
Same here. we have a pipeline that creates the PR on behalf of the author, but since we can't get the CreatedBy field right, we're having issues later on with comments not being shown and approvals.
Any update on this?
Would love to see an update on this.
+1
Any update on this?