Wednesday 30 January 2019

Pull Request Report for Azure Git Repos

When you have several repos in your team project and if you want to obtain a report of pending pull requests, or even completed pull requests, you can use widget available here in your dashboards.Additionally pull request count widget also available in here. Individual repo based pull request dashboard widget also available in Azure DevOps. However, if you want a custom report, you can use REST API and create your own report.
The script made available here can be used to obtain html report on pull requests. You can pass the status of pull request and obtain the pull request list with details such as link to the pull request as well as approver details etc. To execute the script you can use below syntax.
.\FindPullRequests.ps1 -token 'PAT' -collectionUri '' 
-teamProjectName 'teamprojectname' -prStatuses @('active','completed')
You can obtain the report for more than one status by passing them or you can pass a single state such as active to obtain active pull request details.
The script obtains all pull request for a given state and then evaluates its vote state to determine the review actions performed.
Age is calculated considering weekdays and each requests are sorted to show in descending order of age for each status. For weekdays calculation function available here is used in the script. The report would be generated as an html file in the script location.

No comments:

Popular Posts