从GitHub拉取请求获取评论列表 [英] Get list of comments from GitHub pull request

查看:176
本文介绍了从GitHub拉取请求获取评论列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据 http:// developer .github.com / v3 / pulls / comments /#list-comments-on-a-pull-request

我应该可以得到一个列表通过发表以下curl声明发表评论,但是,它将返回空白,好像没有评论,有什么想法为什么?或者我如何才能使这个工作?

  curlhttps://api.github.com/repos/37signals/sub / b $ / pre> 

谢谢!

解决方案

注意顶部附近的文字请求API文档(在TOC下):


Pull Request API允许您列出,查看,编辑,创建,甚至合并请求。可以通过问题评论API来管理对请求的评论。

因此,API端点您目前使用的是用于请求审阅评论的评论,而非正常的请求评论:


合并请求评论评论是关于统一差异的一部分的评论。它们与Commit Comments(直接应用于提交请求,Pull Request视图之外)和Issue Comments(不引用统一差异的一部分)分开。




由于您引用的拉取请求没有任何评论评论,因此您会得到正确的结果(一个空列表)。但是,正如我上面提到的,您应该触及的API端点是问题评论的API端点(因为它与问题ID相同,所以只需使用相同的请求标识):

  curlhttps://api.github.com/repos/37signals/sub/issues/37/comments-v 


According to http://developer.github.com/v3/pulls/comments/#list-comments-on-a-pull-request

I should be able to get a list of comments by issuing the following curl statement, however, it is returning empty, as if there were no comments, any ideas why? or how I can get this to work?

curl "https://api.github.com/repos/37signals/sub/pulls/37/comments" -v

Thank you!

解决方案

Notice the text near the top of the Pull requests API docs (under the TOC):

The Pull Request API allows you to list, view, edit, create, and even merge pull requests. Comments on pull requests can be managed via the Issue Comments API.

So, the API endpoint you are currently using is intended for Pull request review comments, not the normal Pull request comments:

Pull Request Review Comments are comments on a portion of the unified diff. These are separate from Commit Comments (which are applied directly to a commit, outside of the Pull Request view), and Issue Comments (which do not reference a portion of the unified diff).

Since the pull request you are referencing does not have any review comments, you are getting the correct result (an empty list). However, as I mentioned above, the API endpoint you should be hitting is the one for issue comments (just use the same pull request ID since it is equal to the issue ID):

curl "https://api.github.com/repos/37signals/sub/issues/37/comments" -v

这篇关于从GitHub拉取请求获取评论列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆