【问题标题】:How can I get the PullRequestId via a BuildId?如何通过 BuildId 获取 PullRequestId?
【发布时间】:2019-07-20 22:57:05
【问题描述】:

如何通过构建 ID 获取拉取请求 ID?是否有任何现有的 Rest API 来支持这一点?

【问题讨论】:

    标签: azure-devops azure-pipelines pull-request azure-devops-rest-api


    【解决方案1】:

    您可以使用Builds - Get Rest API 获取构建详细信息(您只需要构建 ID):

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

    在 JSON 响应中,您还获得了拉取请求 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\"}",
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-10-19
      • 2011-01-23
      • 2011-02-03
      • 2011-04-02
      • 2023-03-29
      • 2013-06-17
      • 2017-04-08
      • 2020-05-15
      相关资源
      最近更新 更多