admin管理员组

文章数量:1379620

I am looking to do some work item validation on a Pull request prior to approval but i can't see an easy way to do this.

The workflow would be

A developer will create a pull request and include a development, a test and a UAT "task" as part of it.

I want to be able to easily see that the work items are

a) all the tasks listed linked b) they are all set to done c) the names of the assignees of each task are different.

I don't think this is a native option in ADO would this need to be developed and included as a approval check?

I have reviewed the settings for a pull request but it only offers options for linked items must exist not the content of the linked tasks.

Is there the option to write a powershell script that runs as part of the Pull request or an Azure Function that would allow me to do some additional validation when a pull request is triggered. Im reasonably new to Azure and Powershell so any advice would be greatly appreciated.

I am looking to do some work item validation on a Pull request prior to approval but i can't see an easy way to do this.

The workflow would be

A developer will create a pull request and include a development, a test and a UAT "task" as part of it.

I want to be able to easily see that the work items are

a) all the tasks listed linked b) they are all set to done c) the names of the assignees of each task are different.

I don't think this is a native option in ADO would this need to be developed and included as a approval check?

I have reviewed the settings for a pull request but it only offers options for linked items must exist not the content of the linked tasks.

Is there the option to write a powershell script that runs as part of the Pull request or an Azure Function that would allow me to do some additional validation when a pull request is triggered. Im reasonably new to Azure and Powershell so any advice would be greatly appreciated.

Share Improve this question edited Mar 29 at 12:47 qkfang 1,7851 gold badge1 silver badge20 bronze badges asked Mar 28 at 18:39 David RobertsonDavid Robertson 11 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 0

Currently, there is no build-in feature that can meet your needs. As a workaround, you can use build validation policy. When there is new PR created or new commit in source branch, the pipeline will be triggered. You can validate work items in the pipeline by writing your own scripts. In the pipeline:

  1. Run REST API Get Pull Request to get linked work items.

    GET https://dev.azure/{anization}/{project}/_apis/git/repositories/{repositoryId}/pullrequests/{pullRequestId}?includeWorkItemRefs=true&api-version=7.1

    • repositoryId can be obtained from predefined variable Build.Repository.ID.

    • pullRequestId can be obtained from predefined variable System.PullRequest.PullRequestId .

  2. Run REST API Get Work Item to check the state and assignee of each work item.

Customize the script according to your actual needs by yourself.

本文标签: azureADO Pull Request Validate Work Items AutomaticallyStack Overflow