Is there an az cli command that gets the threads and comments on a PR?
PR's can be listed with:
az repos pr list --organization $organization --project "$project" --repository $repo
The REST API has this endpoint, which gets the threads and comments:
GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/pullRequests/{pullRequestId}/threads?api-version=7.1-preview.1
example output cropped:
"value": [
{
"pullRequestThreadContext": null,
"id": 111111,
"publishedDate": "2024-02-19T16:00:00.000Z",
"lastUpdatedDate": "2024-02-19T16:00:00.000Z",
"comments": [],
"status": "active",
"threadContext": null,
"etc": "etc"
},
{
"pullRequestThreadContext": null,
"id": 123456,
"publishedDate": "2024-02-19T16:00:00.000Z",
"lastUpdatedDate": "2024-02-19T16:00:00.000Z",
"comments": [
"content": "Some comment on the PR appears in this field",
"publishedDate": "2024-02-19T16:00:00.000Z",
"lastUpdatedDate": "2024-02-19T16:00:00.00Z",
"lastContentUpdatedDate": "2024-02-19T16:00:00.000Z",
"commentType": "text",
"etc": "etc"`
]
}
]
"etc"
"etc"
}
But there does not seem to be a way to use az repos to get threads and comments.
(I am specifically looking for PR's that have open comments, with "status": "active" and not "status": "fixed": since our automation should not close these PR's. Atm we have no way of differentiating between PR's except for using the REST API, ideally we do not use both REST API and az cli, az cli is more user friendly, so has my preference.)



To get threads with
az devops, you may useinvokesubcommand. To get threads:To get comments in threads: