This past week I started concentrating on optimizing our release processes. I’ve talked about how our team uses VSTS and Git in a previous post. At the end of a sprint, pull requests are created in all of our repositories to merge to the release branches. As the number of our repositories continues to grow, the number of manual steps to merge for releases grows exponentially. Having worked with the VSTS REST API in the past I knew this wouldn’t be difficult to automate. A build would be run that runs the script below for each of our repositories to create pull requests. Service hooks to Slack would then send notifications so the necessary reviewers can approve the newly created pull requests. This same script can be used post release to merge back to Master branches. I commented on every line of code in the script below so I didn’t have to go into details here 🙂
I have been looking for a solution for the exact same problem. Merging code automatically from Release branch to all user branches. The script is beautifully written explaining every detail in comments. Thank you very much for sharing the same.
Thank you very much Sir, I may not have done it this well.
Greetings
Thank you very much for the wonderful work you have done Its really help. Further i want anther help how to associate work items too with the pull request. How can we achieve it.
Hey Ahmad,
Any commits/branches that have associated work items will automatically be linked to the pull request. If the PR doesn’t have any, you can use the Pull Requests – Update API and pass in workItemRefs.
Hope this helps,
Marcus
Marcus
Thanks a lot for your response. But in my case when i create a pull request through rest API for a specific branch workitems does not automatically pop up. But when i manually create a pull request in azure devops they do link automatically.
What is the minimum scope of access should the token have to be able to create a pull request?