Skip to content

Commit 1a0e54f

Browse files
committed
Merge remote-tracking branch 'origin/master' into stats-api-docs
2 parents f5bc3c6 + 23cb959 commit 1a0e54f

11 files changed

+160
-15
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
kind: change
3+
title: User Agent now mandatory
4+
created_at: 2013-04-24
5+
author_name: pengwynn
6+
---
7+
8+
After an almost six week grace period, we're now enforcing the [User Agent
9+
header][1] for all API requests. Most HTTP libraries (including cURL)
10+
set this header by default. If you're experiencing an increase in `403`
11+
responses, be sure and check your code.
12+
13+
[1]: /v3/#user-agent-required
14+
15+
If you have any questions or feedback, please drop us a line at
16+
[[email protected]](mailto:[email protected]?subject=User Agent Requirement).
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
kind: change
3+
title: Deprecating a Confusing Attribute in the Pull Request API
4+
created_at: 2013-04-25
5+
author_name: jasonrudolph
6+
---
7+
8+
When you get the details for a Pull Request from the API, the
9+
[response](/v3/pulls/#get-a-single-pull-request) provides everything there is to
10+
know about that Pull Request. In addition to the useful information provided in
11+
the API response, the JSON also includes the `merge_commit_sha` attribute. This
12+
attribute is a frequent source of misunderstanding, and we aim to remove the
13+
confusion.
14+
15+
To help current API consumers, we've [documented the
16+
attribute](/v3/pulls/#mergability) for improved understanding.
17+
18+
To protect future API consumers from this confusion, we have
19+
[deprecated](/#expected-changes) the `merge_commit_sha` attribute, and we will
20+
remove it in the next major version of the API.
21+
22+
As always, if you have any questions or feedback, please drop us a line at
23+
[[email protected]](mailto:[email protected]?subject=Deprecating merge_commit_sha).
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
kind: change
3+
title: Improved Support for Submodules in the Repository Contents API
4+
created_at: 2013-04-30
5+
author_name: jasonrudolph
6+
---
7+
8+
When you view a repository with a submodule on github.com, you get useful links and information for the submodule.
9+
10+
[![Repository Contents with Submodule](/images/posts/submodule-links.png)][screenshot]
11+
12+
Today we're making that data available in the [Repository Contents API][docs].
13+
14+
<pre class="terminal">
15+
curl https://api.github.com/repos/jquery/jquery/contents/test/qunit
16+
17+
{
18+
"name": "qunit",
19+
"path": "test/qunit",
20+
"type": "submodule",
21+
"submodule_git_url": "git://github.com/jquery/qunit.git",
22+
"sha": "6ca3721222109997540bd6d9ccd396902e0ad2f9",
23+
"size": 0,
24+
"url": "https://api.github.com/repos/jquery/jquery/contents/test/qunit?ref=master",
25+
"git_url": "https://api.github.com/repos/jquery/qunit/git/trees/6ca3721222109997540bd6d9ccd396902e0ad2f9",
26+
"html_url": "https://github.com/jquery/qunit/tree/6ca3721222109997540bd6d9ccd396902e0ad2f9",
27+
"_links": {
28+
"self": "https://api.github.com/repos/jquery/jquery/contents/test/qunit?ref=master",
29+
"git": "https://api.github.com/repos/jquery/qunit/git/trees/6ca3721222109997540bd6d9ccd396902e0ad2f9",
30+
"html": "https://github.com/jquery/qunit/tree/6ca3721222109997540bd6d9ccd396902e0ad2f9"
31+
}
32+
}
33+
</pre>
34+
35+
If you have any questions or feedback, please drop us a line at
36+
[[email protected]](mailto:[email protected]?subject=Submodules in Repository Contents API).
37+
38+
[docs]: /v3/repos/contents/#get-contents
39+
[screenshot]: /images/posts/submodule-links.png
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
kind: change
3+
title: Commit Statuses Now Available for Branches and Tags
4+
created_at: 2013-04-30
5+
author_name: foca
6+
---
7+
8+
Last week we announced [support for build statuses in the branches page][blog].
9+
Now we are extending this to the API. The [API endpoint for commit statuses][doc]
10+
has been extended to allow branch and tag names, as well as commit SHAs.
11+
12+
<pre class="terminal">
13+
curl https://api.github.com/repos/rails/rails/statuses/3-2-stable
14+
</pre>
15+
16+
Enjoy.
17+
18+
[blog]: https://github.com/blog/1484-check-the-status-of-your-branches
19+
[doc]: http://developer.github.com/v3/repos/statuses/#list-statuses-for-a-specific-ref

content/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,14 @@ objects.
3939
* `[ ]` `master_branch` becomes `default_branch`.
4040
* `[ ]` `integrate_branch` on the [repo API](/v3/repos/#get) will no longer be
4141
returned.
42+
* `[ ]` `merge_commit_sha` on the [pull request API](/v3/pulls/#get-a-single-pull-request)
43+
will no longer be returned.
4244
* `[ ]` Use the `private` attribute when creating a private repository,
4345
instead of setting `public` to false.
4446
* `[ ]` Use JSON to POST to the "repos/:owner/:repo/forks" endpoint, instead of a query string.
4547
* `[✓]` <del>User Emails come back [as a hash][v3-email] instead of a string.</del>
4648
* `[ ]` Remove the unused "bio" field for Users.
49+
* `[ ]` When listing the contents of a directory in the [Repository Contents API](/v3/repos/contents/#get-contents), fix the `type` value returned for submodules: change the value to `"submodule"` (instead of `"file"`).
4750

4851
### Breaking Beta Changes
4952

content/v3/pulls.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,18 @@ base
6363
<%= headers 200 %>
6464
<%= json :full_pull %>
6565

66+
### Mergability
67+
68+
Each time the pull request receives new commits, GitHub creates a merge commit
69+
to _test_ whether the pull request can be automatically merged into the base
70+
branch. (This _test_ commit is not added to the base branch or the head branch.)
71+
The `merge_commit_sha` attribute holds the SHA of the _test_ merge commit;
72+
however, this attribute is [deprecated](/#expected-changes) and is scheduled for
73+
removal in the next version of the API. The Boolean `mergable` attribute will
74+
remain to indicate whether the pull request can be automatically merged.
75+
76+
### Alternative Response Formats
77+
6678
Pass the appropriate [media type](/v3/media/#commits-commit-comparison-and-pull-requests) to fetch diff and patch formats.
6779

6880
## Create a pull request

content/v3/repos/contents.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,17 @@ ref
3030

3131
## Get contents
3232

33-
This method returns the contents of any file or directory in a repository.
33+
This method returns the contents of a file or directory in a repository.
3434

3535
GET /repos/:owner/:repo/contents/:path
3636

3737
Files and symlinks support [a custom media type](#custom-media-types) for getting the raw content.
38-
Directories do _not_ support custom media types.
38+
Directories and submodules do _not_ support custom media types.
3939

40-
*Note*: To get a repository's contents recursively, you can [recursively get
41-
the tree](/v3/git/trees/).
40+
*Notes*:
41+
42+
- To get a repository's contents recursively, you can [recursively get the tree](/v3/git/trees/).
43+
- This API supports files up to 1 megabyte in size.
4244

4345
### Parameters
4446

@@ -67,6 +69,16 @@ Otherwise, the API responds with a hash describing the symlink itself:
6769
<%= headers 200 %>
6870
<%= json :symlink_content %>
6971

72+
### Response if content is a submodule
73+
74+
<%= headers 200 %>
75+
<%= json :submodule_content %>
76+
77+
The `submodule_git_url` identifies the location of the submodule repository, and the `sha` identifies a specific commit within the submodule repository.
78+
Git uses the given URL when cloning the submodule repository, and checks out the submodule at that specific commit.
79+
80+
If the submodule repository is not hosted on github.com, the Git URLs (`git_url` and `_links["git"]`) and the github.com URLs (`html_url` and `_links["html"]`) will have null values.
81+
7082
## Get archive link
7183

7284
This method will return a `302` to a URL to download a tarball

content/v3/repos/hooks.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,12 @@ triggered on pushes.
159159
<%= headers 200 %>
160160
<%= json :hook %>
161161

162-
## Test a hook
162+
## Test a `push` hook
163163

164164
This will trigger the hook with the latest push to the current
165-
repository.
165+
repository if the hook is subscribed to `push` events. If the
166+
hook is not subscribed to `push` events, the server will respond
167+
with 204 but no test POST will be generated.
166168

167169
POST /repos/:owner/:repo/hooks/:id/tests
168170

content/v3/repos/statuses.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ Note that the `repo:status` [OAuth scope](/v3/oauth/#scopes) grants targeted
2525
access to Statuses **without** also granting access to repo code, while the
2626
`repo` scope grants permission to code as well as statuses.
2727

28-
## List Statuses for a specific SHA
28+
## List Statuses for a specific Ref
2929

30-
GET /repos/:owner/:repo/statuses/:sha
30+
GET /repos/:owner/:repo/statuses/:ref
3131

3232
### Parameters
3333

34-
sha
35-
: _Required_ **string** - Sha to list the statuses from
34+
ref
35+
: _Required_ **string** - Ref to list the statuses from. It can be a SHA, a branch name, or a tag name.
3636

3737
### Response
3838

lib/resources.rb

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ module Helpers
3232
:pezra => 'f38112009dc16547051c8ac246cee443',
3333
:rick => 'a44d5abad6e86cff4e34d9f0839535c9',
3434
:agh => '6af915d3c6aa4ad30bbad43d8035fe10',
35-
:Caged => '97c3a8eea9b7eaa9e1e93ea3cd47399f'
35+
:jasonrudolph => '592e1e6f041f9a4ec51846fd82013aea',
36+
:Caged => '97c3a8eea9b7eaa9e1e93ea3cd47399f',
37+
:foca => 'd0ca2bf32bda9e9ea8c4473ffc3aaa0d'
3638
}
3739

3840
DefaultTimeFormat = "%B %-d, %Y".freeze
@@ -784,27 +786,27 @@ def text_html(response, status, head = {})
784786

785787
TREE = {
786788
"sha" => "9fb037999f264ba9a7fc6274d15fa3ae2ab98312",
787-
"url" => "https://api.github.com/repo/octocat/Hello-World/trees/9fb037999f264ba9a7fc6274d15fa3ae2ab98312",
789+
"url" => "https://api.github.com/repos/octocat/Hello-World/trees/9fb037999f264ba9a7fc6274d15fa3ae2ab98312",
788790
"tree" => [
789791
{ "path" => "file.rb",
790792
"mode" => "100644",
791793
"type" => "blob",
792794
"size" => 30,
793795
"sha" => "44b4fc6d56897b048c772eb4087f854f46256132",
794-
"url" => "https://api.github.com/octocat/Hello-World/git/blobs/44b4fc6d56897b048c772eb4087f854f46256132",
796+
"url" => "https://api.github.com/repos/octocat/Hello-World/git/blobs/44b4fc6d56897b048c772eb4087f854f46256132",
795797
},
796798
{ "path" => "subdir",
797799
"mode" => "040000",
798800
"type" => "tree",
799801
"sha" => "f484d249c660418515fb01c2b9662073663c242e",
800-
"url" => "https://api.github.com/octocat/Hello-World/git/blobs/f484d249c660418515fb01c2b9662073663c242e"
802+
"url" => "https://api.github.com/repos/octocat/Hello-World/git/blobs/f484d249c660418515fb01c2b9662073663c242e"
801803
},
802804
{ "path" => "exec_file",
803805
"mode" => "100755",
804806
"type" => "blob",
805807
"size" => 75,
806808
"sha" => "45b983be36b73c0788dc9cbcb76cbb80fc7bb057",
807-
"url" => "https://api.github.com/octocat/Hello-World/git/blobs/45b983be36b73c0788dc9cbcb76cbb80fc7bb057",
809+
"url" => "https://api.github.com/repos/octocat/Hello-World/git/blobs/45b983be36b73c0788dc9cbcb76cbb80fc7bb057",
808810
}
809811
]
810812
}
@@ -1021,6 +1023,23 @@ def text_html(response, status, head = {})
10211023
},
10221024
}
10231025

1026+
SUBMODULE_CONTENT = {
1027+
"type" => "submodule",
1028+
"submodule_git_url" => "git://github.com/jquery/qunit.git",
1029+
"size" => 0,
1030+
"name" => "qunit",
1031+
"path" => "test/qunit",
1032+
"sha" => "6ca3721222109997540bd6d9ccd396902e0ad2f9",
1033+
"url" => "https://api.github.com/repos/jquery/jquery/contents/test/qunit?ref=master",
1034+
"git_url" => "https://api.github.com/repos/jquery/qunit/git/trees/6ca3721222109997540bd6d9ccd396902e0ad2f9",
1035+
"html_url" => "https://github.com/jquery/qunit/tree/6ca3721222109997540bd6d9ccd396902e0ad2f9",
1036+
"_links" => {
1037+
"git" => "https://api.github.com/repos/jquery/qunit/git/trees/6ca3721222109997540bd6d9ccd396902e0ad2f9",
1038+
"self" => "https://api.github.com/repos/jquery/jquery/contents/test/qunit?ref=master",
1039+
"html" => "https://github.com/jquery/qunit/tree/6ca3721222109997540bd6d9ccd396902e0ad2f9"
1040+
}
1041+
}
1042+
10241043
DIRECTORY_CONTENT = [
10251044
{
10261045
"type" => "file",

0 commit comments

Comments
 (0)