How to manage the full Pull Request process in Visual Studio Code with Azure DevOps

Viewed 2329

I was trying to have a full change from the commit to the pull-request/review process in a Azure DevOps repo with Visual Studio Code.

All good till the point where I have to create a Pull Request.

I didn't find an embedded way to do it. There is a plugin Pull Requests for Azure Devops but it seems to be not maintained anymore.

Do you know any other good way to do it? Or may be Microsoft can invest in this important feature?

3 Answers

In our team, we started using the Azure CLI but found it too verbose to be practical. We also wanted to have a similar API to the GitHub CLI.

To fix this, we developed doing-cli, which is essentially a wrapper around the Azure CLI with a feel of the GitHub CLI.

A typical workflow for us is:

  • doing list to see open work items
  • doing issue create <issue title> to create a new work item
  • doing pr create <issue number> to create a branch and a PR based on an existing work item

Our company requires that all PRs are linked to a work item. But sometimes you want to fix things quickly, without having to always create a new work item, create a new branch, link them and open a PR. So we implemented doing workon <title> which will do all these steps for you, as well as checkout the newly created branch.

There used to be an extension, but it got pulled.

When you install the azure cli and the devops extension and then create a pull request from the terminal:

az extension add --name azure-devops
az devops configure --defaults organization=https://dev.azure.com/contoso project=ContosoWebApp
az devops pr create --repository MyRepo --open --source-branch branch-name

That last command needs 2 parameters that can be teased out of the context in a repo folder, that way you can easily alias this to a generic command.

Very few people were uring the Azure Repos and PR for Azure DevOps extensions. And most of Microsoft's investments are in GitHub.

As suggested by Jessehouwing's answer, you can create pull requests using Azure CLI.

In addition, you can also use the REST API Pull Requests - Create:

POST https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/pullrequests?api-version=6.0

Here is an example of the request body:

{
  "sourceRefName": "refs/heads/npaulk/my_work",
  "targetRefName": "refs/heads/new_feature",
  "title": "A new feature",
  "description": "Adding a new feature"
}
Related