How can I get the PullRequestId via a BuildId?

旧城冷巷雨未停 提交于 2019-12-13 03:54:28

问题


How can I get the Pull Request Id via a Build Id? Is there any existing Rest API to support this?


回答1:


You can get the build details with Builds - Get Rest API (you just need the Build Id):

GET https://dev.azure.com/{organization}/{project}/_apis/build/builds/{buildId}?api-version=5.0

In the JSON response, you got also the Pull Request Id:

"parameters":"{
      \"system.pullRequest.pullRequestId\":\"1\",\"system.pullRequest.sourceBranch\":\"refs/heads/build\",\"system.pullRequest.targetBranch\":\"refs/heads/master\",\"system.pullRequest.sourceCommitId\":\"2e9f40aee78e1c916a6d6715ce9727d9bfbe940c\",\"system.pullRequest.sourceRepositoryUri\":\"https://shaykia@dev.azure.com/shaykia/Test/_git/Test\"}",


来源:https://stackoverflow.com/questions/54901768/how-can-i-get-the-pullrequestid-via-a-buildid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!