4

How can I programmatically get the following information? (1 required check)

One required check

I've looked at the response for getting a Pull Request by Id but there's nothing in there from what I can see. I've tried getting a Pull Request Status but that just returns an empty array.

Mark Walsh
  • 3,241
  • 1
  • 24
  • 46
  • Does the List command return anything for that PR? https://learn.microsoft.com/en-us/rest/api/azure/devops/git/pull-request-statuses/list?view=azure-devops-rest-7.1 – Yan Sklyarenko May 03 '22 at 07:33
  • I tested myself, and I don't think there's any way to do what you're trying to achieve here. Pull request status API only returns custom statuses but not required checks. – alessandrocb May 03 '22 at 14:48

1 Answers1

3

You can get it by retrieving a list of all the policy evaluation statuses for a specific pull request.

https://learn.microsoft.com/en-us/rest/api/azure/devops/policy/evaluations/list?view=azure-devops-rest-7.1

eorll
  • 146
  • 4
  • 2
    Also important to note - this is how you generate an artifact ID: https://stackoverflow.com/questions/66114604/azure-devops-generate-an-artifact-id-for-a-pull-request – Mark Walsh May 06 '22 at 09:04
  • Very useful! One note, I needed the "followup" checks that appear in the UI - like releases triggered by the builds defined in the policy - and that doesn't show up in this API, only in the PR Statuses API. The result of both appears to match the AzDO UI. – Ran Sagy Aug 07 '22 at 14:40