【问题标题】:Azure DevOps - Gather a list of repositories that "Require Reviewers" on PRs and for what branchesAzure DevOps - 收集在 PR 上“需要审阅者”的存储库列表以及哪些分支
【发布时间】:2021-08-19 21:41:19
【问题描述】:

在 Azure DevOps 中,他们是一种收集存储库列表的方法,这些存储库强制执行“拉取请求和哪些分支需要审查员?

【问题讨论】:

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


    【解决方案1】:

    您可以使用Configurations - Listrest 来获取对拉取请求强制执行“必需审阅者”的存储库和分支。

    GET https://dev.azure.com/{organization}/{project}/_apis/policy/configurations?policyType={policyType}&api-version=6.1-preview.1
    

    上述“policyType”对于Required Reviewers的ID是“fd2167ab-b0be-447a-8ec8-39368250530e”(您可以使用Types - Listrest api列出所有policyTypes)见下图:

    所以你可以将上面的rest api更改为下面:

    https://dev.azure.com/{organization}/{project}/_apis/policy/configurations?policyType=fd2167ab-b0be-447a-8ec8-39368250530e&api-version=6.1-preview.1
    

    见以下结果示例:

    【讨论】:

    • 感谢这项工作。我还找到了另一种方法,可以在此处找到:vinijmoura.medium.com/…,并且在设置后大约需要 15-20 分钟才能在 powershell 中运行。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-04-21
    • 2020-02-07
    • 1970-01-01
    • 2023-01-31
    • 2021-09-29
    • 1970-01-01
    • 2021-10-24
    相关资源
    最近更新 更多