Azure DevOps 为拉取请求生成工件 ID
Azure DevOps generate an Artifact ID for a Pull Request
Azure DevOps API 文章 Evaluations - List 描述了如何接收特定拉取请求的所有策略评估状态的列表。
打电话
GET https://dev.azure.com/{organization}/{project}/_apis/policy/evaluations?artifactId={artifactId}&api-version=6.0-preview.1
您需要 artifactId
的请求。 artifactId
标识拉取请求,它可能是来自 Pull Requests - Get Pull Request 的响应的一部分。但它不是,artifactId?
是空的。
因此,我认为,文章的作者添加了以下部分:
Evaluations are retrieved using an artifact ID which uniquely identifies the pull request. To generate an artifact ID for a pull request, use this template:
vstfs:///CodeReview/CodeReviewId/{projectId}/{pullRequestId}
我应该用这个模板做什么?有例子吗?我不明白这部分,不知道该怎么办。
文档中的描述表示值 artifact ID
的格式如下:
vstfs:///CodeReview/CodeReviewId/{projectId}/{pullRequestId}
因此您可以使用如下模板:
https://dev.azure.com/{organization}/{project}/_apis/policy/evaluations?artifactId=vstfs:///CodeReview/CodeReviewId/{projectId}/{pullRequestId}&api-version=6.1-preview.1
请参阅下面的 powershell 示例:
$pat = "36w.......f65q"
$base64AuthInfo= [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$($pat)"))
$url = "https://dev.azure.com/myOrg/myProj/_apis/policy/evaluations?artifactId=vstfs:///CodeReview/CodeReviewId/39-...e13f/148&api-version=6.1-preview.1"
Invoke-RestMethod -Uri $url -Headers @{Authorization = "Basic {0}" -f $base64AuthInfo} -Method Get
Azure DevOps API 文章 Evaluations - List 描述了如何接收特定拉取请求的所有策略评估状态的列表。
打电话
GET https://dev.azure.com/{organization}/{project}/_apis/policy/evaluations?artifactId={artifactId}&api-version=6.0-preview.1
您需要 artifactId
的请求。 artifactId
标识拉取请求,它可能是来自 Pull Requests - Get Pull Request 的响应的一部分。但它不是,artifactId?
是空的。
因此,我认为,文章的作者添加了以下部分:
Evaluations are retrieved using an artifact ID which uniquely identifies the pull request. To generate an artifact ID for a pull request, use this template:
vstfs:///CodeReview/CodeReviewId/{projectId}/{pullRequestId}
我应该用这个模板做什么?有例子吗?我不明白这部分,不知道该怎么办。
文档中的描述表示值 artifact ID
的格式如下:
vstfs:///CodeReview/CodeReviewId/{projectId}/{pullRequestId}
因此您可以使用如下模板:
https://dev.azure.com/{organization}/{project}/_apis/policy/evaluations?artifactId=vstfs:///CodeReview/CodeReviewId/{projectId}/{pullRequestId}&api-version=6.1-preview.1
请参阅下面的 powershell 示例:
$pat = "36w.......f65q"
$base64AuthInfo= [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$($pat)"))
$url = "https://dev.azure.com/myOrg/myProj/_apis/policy/evaluations?artifactId=vstfs:///CodeReview/CodeReviewId/39-...e13f/148&api-version=6.1-preview.1"
Invoke-RestMethod -Uri $url -Headers @{Authorization = "Basic {0}" -f $base64AuthInfo} -Method Get