Create an automatic PR and complete it Azure DevOps

0 votes

When a PR from branch a to branch b is finished, an automatic PR from branch c to branch d is prepared and completed.

This query does not mention autocomplete, as far as I can tell.

Also, can I provide a policy to the automated PR so that it completes itself?

Update

I tried the following number:

https://docs.microsoft.com/en-us/rest/api/azure/devops/git/pull%20requests/update?view=azure-devops-rest-5.1

But I got the error:

Invoke-RestMethod : {"$id":"1","innerException":null,"message":"Invalid argument value.\r\nParameter name: Invalid 
pull request auto complete set by id. Valid values are either the current user identity id, or an empty guid (to unset 
auto complete)."
I attempted to extract the creator ID from the answer, but it was missing.
Feb 9 in Other DevOps Questions by Edureka
• 840 points
147 views

1 answer to this question.

0 votes

You can retrieve the creator ID after you've created the PR:

$response = Invoke-RestMethod -Uri $url -Method Post -Headers $head -Body $jsonBody -ContentType "application/json;charset=UTF-8"

$currentUserId = $response.createdBy.id

And include the following in the update json body:

$body = @{
    autoCompleteSetBy = @{ id = "$buildUserId" }
    completionOptions = ""
}    

$response = Invoke-RestMethod -Uri $url -Method Patch -Headers $head -Body $jsonBody -ContentType application/json
answered Feb 9 by Bhavitha
• 980 points

Related Questions In Other DevOps Questions

0 votes
0 answers
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
1,592 views
+2 votes
1 answer
0 votes
1 answer

Is it possible to have a link to raw content of file in Azure DevOps

Sure, here's the call for the rests: GET ...READ MORE

answered Feb 10 in Other DevOps Questions by Bhavitha
• 980 points
56 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP