如何通过BuildId获取PullRequestId?

问题描述 投票:0回答:1

如何通过构建ID获取Pull Request ID?是否有任何现有的Rest API支持此功能?

azure-devops azure-pipelines pull-request azure-devops-rest-api
1个回答
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://[email protected]/shaykia/Test/_git/Test\"}",
© www.soinside.com 2019 - 2024. All rights reserved.