Вы можете использовать Policy API и получить список всех ветвей с политиками.
Получить список конфигураций политик в проекте.
GET https://dev.azure.com/{organization}/{project}/_apis/policy/configurations?api-version=4.1
Пример ответа:
{
"count": 3,
"value": [
{
"createdBy": {
"id": "d6245f20-2af8-44f4-9451-8107cb2767db",
"displayName": "Normal Paulk",
"uniqueName": "fabrikamfiber16@hotmail.com",
"url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/d6245f20-2af8-44f4-9451-8107cb2767db",
"imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=d6245f20-2af8-44f4-9451-8107cb2767db"
},
"createdDate": "2015-02-23T12:51:06.85754Z",
"isEnabled": true,
"isBlocking": true,
"isDeleted": false,
"settings": {
"requiredReviewerIds": [
"1d1dad71-f27c-4370-810d-838ec41efd41",
"13272ea3-92ef-46d1-b77e-608ebbf3428b"
],
"filenamePatterns": [
"*/API*.cs",
"sql/tables/*"
],
"addedFilesOnly": false,
"message": null,
"scope": [
{
"refName": "refs/heads/master",
"matchKind": "Exact",
"repositoryId": null
},
{
"refName": "refs/heads/releases/",
"matchKind": "Prefix",
"repositoryId": null
},
{
"refName": "refs/heads/adventureworks",
"matchKind": "Exact",
"repositoryId": "49c1d4d0-be28-4f20-9e0a-4ecfafc39257"
}
]
},
"_links": {
"self": {
"href": "https://dev.azure.com/fabrikam/_apis/policy/configurations/17"
},
"policyType": {
"href": "https://dev.azure.com/fabrikam/1be3fc5b-c58c-4173-8fd7-6647d11eccd1/_apis/policy/types/fd2167ab-b0be-447a-8ec8-39368250530e"
}
},
"revision": 2,
"id": 17,
"url": "https://dev.azure.com/fabrikam/_apis/policy/configurations/17",
"type": {
"id": "fd2167ab-b0be-447a-8ec8-39368250530e",
"url": "https://dev.azure.com/fabrikam/1be3fc5b-c58c-4173-8fd7-6647d11eccd1/_apis/policy/types/fd2167ab-b0be-447a-8ec8-39368250530e",
"displayName": "Required reviewers"
}
},
{
"createdBy": {
"id": "d6245f20-2af8-44f4-9451-8107cb2767db",
"displayName": "Normal Paulk",
"uniqueName": "fabrikamfiber16@hotmail.com",
"url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/d6245f20-2af8-44f4-9451-8107cb2767db",
"imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=d6245f20-2af8-44f4-9451-8107cb2767db"
},
"createdDate": "2015-02-23T12:51:06.8887894Z",
"isEnabled": true,
"isBlocking": false,
"settings": {
"minimumApproverCount": 1,
"creatorVoteCounts": false,
"scope": [
{
"refName": "refs/heads/master",
"matchKind": "Exact",
"repositoryId": null
}
]
},
"_links": {
"self": {
"href": "https://dev.azure.com/fabrikam/_apis/policy/configurations/18"
},
"policyType": {
"href": "https://dev.azure.com/fabrikam/1be3fc5b-c58c-4173-8fd7-6647d11eccd1/_apis/policy/types/fa4e907d-c16b-4a4c-9dfa-4906e5d171dd"
}
},
"revision": 1,
"id": 18,
"url": "https://dev.azure.com/fabrikam/_apis/policy/configurations/18",
"type": {
"id": "fa4e907d-c16b-4a4c-9dfa-4906e5d171dd",
"url": "https://dev.azure.com/fabrikam/1be3fc5b-c58c-4173-8fd7-6647d11eccd1/_apis/policy/types/fa4e907d-c16b-4a4c-9dfa-4906e5d171dd",
"displayName": "Minimum approval count"
}
},
{
"createdBy": {
"id": "d6245f20-2af8-44f4-9451-8107cb2767db",
"displayName": "Normal Paulk",
"uniqueName": "fabrikamfiber16@hotmail.com",
"url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/d6245f20-2af8-44f4-9451-8107cb2767db",
"imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=d6245f20-2af8-44f4-9451-8107cb2767db"
},
"createdDate": "2015-02-23T12:51:06.935666Z",
"isEnabled": true,
"isBlocking": false,
"settings": {
"buildDefinitionId": 5,
"scope": [
{
"refName": "refs/heads/features/",
"matchKind": "Prefix",
"repositoryId": null
}
]
},
"_links": {
"self": {
"href": "https://dev.azure.com/fabrikam/_apis/policy/configurations/19"
},
"policyType": {
"href": "https://dev.azure.com/fabrikam/1be3fc5b-c58c-4173-8fd7-6647d11eccd1/_apis/policy/types/0609b952-1397-4640-95ec-e00a01b2c241"
}
},
"revision": 1,
"id": 19,
"url": "https://dev.azure.com/fabrikam/_apis/policy/configurations/19",
"type": {
"id": "0609b952-1397-4640-95ec-e00a01b2c241",
"url": "https://dev.azure.com/fabrikam/1be3fc5b-c58c-4173-8fd7-6647d11eccd1/_apis/policy/types/0609b952-1397-4640-95ec-e00a01b2c241",
"displayName": "Build"
}
}
]
}
В refName
в разделе scope
вы можете увидеть название ветви с политикой, в policyType
у вас есть ссылка для получения
описание типа политики.