| title | Comments | GitHub API |
|---|
- TOC {:toc}
Commit Comments use these custom media types. You can read more about the use of media types in the API here.
Comments are ordered by ascending ID.
GET /repos/:owner/:repo/comments
<%= headers 200, :pagination => default_pagination_rels %> <%= json(:commit_comment) { |h| [h] } %>
GET /repos/:owner/:repo/commits/:ref/comments
<%= headers 200, :pagination => default_pagination_rels %> <%= json(:commit_comment) { |h| [h] } %>
POST /repos/:owner/:repo/commits/:sha/comments
| Name | Type | Description |
|---|---|---|
body |
string |
Required. The contents of the comment. |
path |
string |
Relative path of the file to comment on. |
position |
number |
Line index in the diff to comment on. |
line |
number |
Deprecated. Use position parameter instead. Line number in the file to comment on. |
<%= json
:body => 'Nice change',
:path => 'file1.txt',
:position => 4,
:line => nil
%>
<%= headers 201, :Location => get_resource(:commit_comment)['url'] %> <%= json :commit_comment %>
GET /repos/:owner/:repo/comments/:id
<%= headers 200 %> <%= json :commit_comment %>
PATCH /repos/:owner/:repo/comments/:id
| Name | Type | Description |
|---|---|---|
body |
string |
Required. The contents of the comment |
<%= json
:body => 'Nice change'
%>
<%= headers 200 %> <%= json :commit_comment %>
DELETE /repos/:owner/:repo/comments/:id
<%= headers 204 %>
These are the supported media types for commit comments. You can read more about the use of media types in the API here.
application/vnd.github-commitcomment.raw+json
application/vnd.github-commitcomment.text+json
application/vnd.github-commitcomment.html+json
application/vnd.github-commitcomment.full+json