我想获取针对GitHub存储库提出的所有拉取请求的审阅注释。它是企业GitHub和私有存储库。 例如:
我如何使用GitHub API来获取所有提出的所有PR的所有评论注释。
答案 0 :(得分:0)
API的Pulls端点为:https://developer.github.com/enterprise/2.17/v3/pulls/
您可以使用以下卷曲来获得回购的所有拉动:
curl -H "Authorization: token PERSONALACCESSTOKEN" -get https://GHEURL/api/v3/repos/REPOOWNER/REPO/pulls?state=all
因此,从示例网址来看,应该是
curl -H "Authorization: token PERSONALACCESSTOKEN" -get https://github.mycomp.com/api/v3/repos/MyRepo/MyProject/pulls?state=all
一旦有了Pulls列表,您将需要找到您感兴趣的Pulls,然后使用Pulls / Comments API端点查看评论注释: https://developer.github.com/enterprise/2.17/v3/pulls/comments/
示例CURL:
curl -H "Authorization: token PERSONALACCESSTOKEN" -get https://github.mycomp.com/api/v3/repos/MyRepo/MyProject/pulls/3/comments
如果您要查找的评论没有评论,则需要使用Issues / Comments API端点: https://developer.github.com/enterprise/2.17/v3/issues/comments/
示例CURL:
curl -H "Authorization: token PERSONALACCESSTOKEN" -get https://github.mycomp.com/api/v3/repos/MyRepo/MyProject/issues/3/comments