Skip to content

Commit 2f4f43a

Browse files
committed
Add docs for commit comments
1 parent 1f98d8c commit 2f4f43a

File tree

7 files changed

+147
-32
lines changed

7 files changed

+147
-32
lines changed

content/v3/pulls.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ values are `open` and `closed`.
106106
<%= headers 200 %>
107107
<%= json :pull %>
108108

109-
## List pull requests commits
109+
## List commits on a pull request
110110

111-
GET /repo/:user/:repo/pulls/:id/commits
111+
GET /repos/:user/:repo/pulls/:id/commits
112112

113113
### Response
114114

content/v3/pulls/comments.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ path
4040
being commented on.
4141

4242
position
43-
: _Required_ **number** of the line this comment is anchored to.
43+
: _Required_ **number** of the line index into the diff where this
44+
comment is being made.
4445

4546
#### Example
4647

content/v3/pulls/commits.md

Lines changed: 0 additions & 14 deletions
This file was deleted.

content/v3/pulls/files.md

Lines changed: 0 additions & 13 deletions
This file was deleted.

content/v3/repos/commits.md

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
---
2+
title: Repo Commits API v3 | developer.github.com
3+
---
4+
5+
# Repo Commits API
6+
7+
## List commits on a repository
8+
9+
GET /repos/:user/:repo/commits
10+
11+
### Parameters
12+
13+
sha
14+
: _Optional_ **string** specifying the sha or branch to start listing commits
15+
from.
16+
17+
path
18+
: _Optional_ **string** file path. Only commits containing this file
19+
will be returned.
20+
21+
### Response
22+
23+
<%= headers 200 %>
24+
<%= json(:commit) { |h| [h] } %>
25+
26+
## Get a single commit
27+
28+
GET /repos/:user/:repo/commits/:sha
29+
30+
### Response
31+
32+
<%= headers 200 %>
33+
<%= json(:commit) %>
34+
35+
## List commit comments for a repository
36+
37+
GET /repos/:user/:repo/comments
38+
39+
### Response
40+
41+
<%= headers 200 %>
42+
<%= json(:commit_comment) { |h| [h] } %>
43+
44+
## List comments for a single commit
45+
46+
GET /repos/:user/:repo/commits/:sha/comments
47+
48+
### Response
49+
50+
<%= headers 200 %>
51+
<%= json(:commit_comment) %>
52+
53+
## Create a commit comment
54+
55+
POST /repos/:user/:repo/commits/:sha/comments
56+
57+
### Input
58+
59+
body
60+
: _Required_ **string** for the body of the comment.
61+
62+
commit_id
63+
: _Required_ **string** specifying the commit sha this comment was made
64+
against.
65+
66+
line
67+
: _Required_ **number** of the line in the file where this comment is
68+
being made.
69+
70+
path
71+
: _Required_ **string** specifying the relative path of the file that is
72+
being commented on.
73+
74+
position
75+
: _Required_ **number** of the line index into the diff where this
76+
comment is being made.
77+
78+
#### Example
79+
80+
<%= json \
81+
:body => 'Nice change',
82+
:commit_id => '6dcb09b5b57875f334f61aebed695e2e4193db5e',
83+
:line => 1,
84+
:path => 'file1.txt',
85+
:position => 4,
86+
%>
87+
88+
### Response
89+
90+
<%= headers 201, :Location => "https://api.github.com/user/repo/comments/1" %>
91+
<%= json :commit_comment %>
92+
93+
## Get a single commit comment
94+
95+
GET /repos/:user/:repo/comments/:id
96+
97+
### Response
98+
99+
<%= headers 200 %>
100+
<%= json :commit_comment %>
101+
102+
## Update a commit comment
103+
104+
PATCH /repos/:user/:repo/comments/:id
105+
106+
### Input
107+
108+
body
109+
: _Required_ **string** for the body of the comment.
110+
111+
#### Example
112+
113+
<%= json \
114+
:body => 'Nice change'
115+
%>
116+
117+
### Response
118+
119+
<%= headers 200 %>
120+
<%= json :commit_comment %>
121+
122+
## Delete a commit comment
123+
124+
DELETE /repos/:user/:repo/comments/:id
125+
126+
### Response
127+
128+
<%= headers 204 %>
129+

layouts/default.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ <h3><a href="/v3/orgs/">Orgs</a></h3>
6969
<h3><a href="/v3/repos/">Repos</a></h3>
7070
<ul>
7171
<li><a href="/v3/repos/collaborators/">Collaborators</a></li>
72+
<li><a href="/v3/repos/commits/">Commits</a></li>
7273
<li><a href="/v3/repos/forks/">Forks</a></li>
7374
<li><a href="/v3/repos/keys/">Keys</a></li>
7475
<li><a href="/v3/repos/watching/">Watching</a></li>
@@ -78,8 +79,6 @@ <h3><a href="/v3/repos/">Repos</a></h3>
7879
<h3><a href="/v3/pulls/">Pull Requests</a></h3>
7980
<ul>
8081
<li><a href="/v3/pulls/comments/">Comments</a></li>
81-
<li><a href="/v3/pulls/commits/">Commits</a></li>
82-
<li><a href="/v3/pulls/files/">Files</a></li>
8382
</li>
8483
<li>
8584
<h3><a href="/v3/users/">Users</a></h3>

lib/resources.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,18 @@ def json(key)
188188
COMMIT = {
189189
}
190190

191+
COMMIT_COMMENT = {
192+
"url" => "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1",
193+
"id" => 1,
194+
"body" => "Great stuff",
195+
"path" => "file1.txt",
196+
"position" => 4,
197+
"commit_id" => "6dcb09b5b57875f334f61aebed695e2e4193db5e",
198+
"user" => USER,
199+
"created_at" => "2011-04-14T16:00:49Z",
200+
"updated_at" => "2011-04-14T16:00:49Z"
201+
}
202+
191203
FILE = {
192204
"sha" => "6dcb09b5b57875f334f61aebed695e2e4193db5e",
193205
"filename" => "file1.txt",
@@ -202,6 +214,7 @@ def json(key)
202214

203215
PULL_COMMENT = {
204216
"url" => "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1",
217+
"id" => 1,
205218
"body" => "Great stuff",
206219
"path" => "file1.txt",
207220
"position" => 4,

0 commit comments

Comments
 (0)