如何通过构建ID获取拉取请求ID?是否有任何现有的Rest API支持此功能?
答案 0 :(得分:1)
您可以使用Builds - Get Rest API(仅需要构建ID)获取构建详细信息:
GET https://dev.azure.com/{organization}/{project}/_apis/build/builds/{buildId}?api-version=5.0
在JSON响应中,您还获得了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\"}",