Code Sharing (PowerShell): Create Pull Request via VSTS REST API

Thumbnail Image

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 🙂

Share: X (Twitter) LinkedIn