是否存在Azure CLI命令用于获取Pull Request的线程及评论?
关于Azure CLI获取PR线程与评论的问题
是否存在az cli命令可获取Pull Request(PR)的线程与评论?
已有的Azure CLI PR列表命令
可通过以下命令列出PR:
az repos pr list --organization $organization --project "$project" --repository $repo
获取PR线程与评论的REST API方式
REST API有如下端点可获取线程与评论:
GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/pullRequests/{pullRequestId}/threads?api-version=7.1-preview.1
API返回示例输出
{ "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" }
当前限制与需求
目前似乎无法通过az repos直接获取线程与评论。
我需要筛选出带有状态为"status": "active"而非"status": "fixed"的未关闭评论的PR,因为自动化流程不应关闭此类PR。目前只能通过REST API区分这类PR,理想情况是仅使用更易用的Azure CLI,而非同时使用两种工具。
内容的提问来源于stack exchange,提问作者Roelof
相关产品推荐
相关产品推荐

