From 3f40d00c588e90bb879726a2d03372098e29b5b3 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Tue, 7 Jun 2016 09:30:31 +0200 Subject: [PATCH 01/54] correct Accept media type to remove sha suffix --- content/v3/git/commits.md | 2 +- content/v3/git/tags.md | 2 +- content/v3/repos/commits.md | 2 +- content/v3/users/gpg_keys.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/content/v3/git/commits.md b/content/v3/git/commits.md index 8b6a43bcd0..2f1a35036a 100644 --- a/content/v3/git/commits.md +++ b/content/v3/git/commits.md @@ -72,7 +72,7 @@ Please see the [blog post](/changes/2016-04-04-git-signing-api-preview) for full To receive signature verification data in commit objects you must provide a custom [media type](/v3/media) in the `Accept` header: - application/vnd.github.cryptographer-preview+sha + application/vnd.github.cryptographer-preview {{/tip}} diff --git a/content/v3/git/tags.md b/content/v3/git/tags.md index 42ce97eca8..6a56694a48 100644 --- a/content/v3/git/tags.md +++ b/content/v3/git/tags.md @@ -76,7 +76,7 @@ Please see the [blog post](/changes/2016-04-04-git-signing-api-preview) for full To receive signature verification data in tag objects you must provide a custom [media type](/v3/media) in the `Accept` header: - application/vnd.github.cryptographer-preview+sha + application/vnd.github.cryptographer-preview {{/tip}} diff --git a/content/v3/repos/commits.md b/content/v3/repos/commits.md index 7c5020a242..a9fbac3e40 100644 --- a/content/v3/repos/commits.md +++ b/content/v3/repos/commits.md @@ -98,7 +98,7 @@ Please see the [blog post](/changes/2016-04-04-git-signing-api-preview) for full To receive signature verification data in commit objects you must provide a custom [media type](/v3/media) in the `Accept` header: - application/vnd.github.cryptographer-preview+sha + application/vnd.github.cryptographer-preview {{/tip}} diff --git a/content/v3/users/gpg_keys.md b/content/v3/users/gpg_keys.md index 935f7ecab3..448737dc56 100644 --- a/content/v3/users/gpg_keys.md +++ b/content/v3/users/gpg_keys.md @@ -16,7 +16,7 @@ title: User GPG Keys To access the API you must provide a custom [media type](/v3/media) in the `Accept` header: - application/vnd.github.cryptographer-preview+sha + application/vnd.github.cryptographer-preview {{/tip}} From 1ee6be92c6d301a0ca06b6a90797e59e6115c1df Mon Sep 17 00:00:00 2001 From: Ruben Dijkstra Date: Wed, 15 Jun 2016 00:27:54 +0200 Subject: [PATCH 02/54] Add the original assignee to the list of assignees --- lib/responses/issues_and_prs.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/responses/issues_and_prs.rb b/lib/responses/issues_and_prs.rb index d955cb1744..0f7d9a0fb9 100644 --- a/lib/responses/issues_and_prs.rb +++ b/lib/responses/issues_and_prs.rb @@ -135,6 +135,7 @@ module Responses ISSUE_WITH_ASSIGNEES ||= ISSUE.merge({ "assignees" => [ + USER, USER.merge("login" => "hubot"), USER.merge("login" => "other_user") ] From aae43caa7b147a24b6b3b1989493ee364cd5cb21 Mon Sep 17 00:00:00 2001 From: Ruben Dijkstra Date: Wed, 15 Jun 2016 00:28:42 +0200 Subject: [PATCH 03/54] Rename the USERS to the right user This introduces new constants, so that they can be used in other places as well. This makes the data a little more realistic. --- lib/responses/issues_and_prs.rb | 4 ++-- lib/responses/user.rb | 40 +++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/lib/responses/issues_and_prs.rb b/lib/responses/issues_and_prs.rb index 0f7d9a0fb9..847579d06a 100644 --- a/lib/responses/issues_and_prs.rb +++ b/lib/responses/issues_and_prs.rb @@ -136,8 +136,8 @@ module Responses ISSUE_WITH_ASSIGNEES ||= ISSUE.merge({ "assignees" => [ USER, - USER.merge("login" => "hubot"), - USER.merge("login" => "other_user") + HUBOT, + OTHER_USER ] }) diff --git a/lib/responses/user.rb b/lib/responses/user.rb index 402ad59936..300cd900e6 100644 --- a/lib/responses/user.rb +++ b/lib/responses/user.rb @@ -21,6 +21,46 @@ module Responses "site_admin" => false } + HUBOT ||= { + "login" => "hubot", + "id" => 1, + "avatar_url" => "https://github.com/images/error/hubot_happy.gif", + "gravatar_id" => "", + "url" => "https://api.github.com/users/hubot", + "html_url" => "https://github.com/hubot", + "followers_url" => "https://api.github.com/users/hubot/followers", + "following_url" => "https://api.github.com/users/hubot/following{/other_user}", + "gists_url" => "https://api.github.com/users/hubot/gists{/gist_id}", + "starred_url" => "https://api.github.com/users/hubot/starred{/owner}{/repo}", + "subscriptions_url" => "https://api.github.com/users/hubot/subscriptions", + "organizations_url" => "https://api.github.com/users/hubot/orgs", + "repos_url" => "https://api.github.com/users/hubot/repos", + "events_url" => "https://api.github.com/users/hubot/events{/privacy}", + "received_events_url" => "https://api.github.com/users/hubot/received_events", + "type" => "User", + "site_admin" => true + } + + OTHER_USER ||= { + "login" => "other_user", + "id" => 1, + "avatar_url" => "https://github.com/images/error/other_user_happy.gif", + "gravatar_id" => "", + "url" => "https://api.github.com/users/other_user", + "html_url" => "https://github.com/other_user", + "followers_url" => "https://api.github.com/users/other_user/followers", + "following_url" => "https://api.github.com/users/other_user/following{/other_user}", + "gists_url" => "https://api.github.com/users/other_user/gists{/gist_id}", + "starred_url" => "https://api.github.com/users/other_user/starred{/owner}{/repo}", + "subscriptions_url" => "https://api.github.com/users/other_user/subscriptions", + "organizations_url" => "https://api.github.com/users/other_user/orgs", + "repos_url" => "https://api.github.com/users/other_user/repos", + "events_url" => "https://api.github.com/users/other_user/events{/privacy}", + "received_events_url" => "https://api.github.com/users/other_user/received_events", + "type" => "User", + "site_admin" => false + } + CONTRIBUTOR ||= USER.merge({ "contributions" => 32 }) From 40e5d048e54400ac3c327edd26788e9e39a09cc6 Mon Sep 17 00:00:00 2001 From: Hubot Date: Thu, 16 Jun 2016 06:15:15 -0700 Subject: [PATCH 04/54] Sync changes from upstream repository --- .../2016-06-14-repository-invitations.md | 28 ++++++ content/v3/oauth.md | 2 +- content/v3/repos/collaborators.md | 16 +++ content/v3/repos/invitations.md | 98 +++++++++++++++++++ layouts/sidebar.html | 1 + lib/responses/repos.rb | 12 +++ 6 files changed, 156 insertions(+), 1 deletion(-) create mode 100644 content/changes/2016-06-14-repository-invitations.md create mode 100644 content/v3/repos/invitations.md diff --git a/content/changes/2016-06-14-repository-invitations.md b/content/changes/2016-06-14-repository-invitations.md new file mode 100644 index 0000000000..5d39cdf46c --- /dev/null +++ b/content/changes/2016-06-14-repository-invitations.md @@ -0,0 +1,28 @@ +--- +title: API changes for Repository Invitations +author_name: CoralineAda +--- + +We announced [repository invitation functionality][repo-invitations-announcement] on May 23. Using the site, you can invite collaborators to work on your repository. Invitees will receive an email with the invitation and have the option to accept or decline. + +We have now have endpoints for managing repository invitations for both repository administrators and invitation recipients through the GitHub API. You can enable these changes during the preview period by providing a custom [media type][media-type] in the `Accept` header: + + application/vnd.github.swamp-thing-preview + +For example: + + ``` command-line + curl "https://api.github.com/api/v3/repositories/1313/invitations" \ + -H 'Authorization: token TOKEN' \ + -H "Accept: application/vnd.github.swamp-thing-preview" \ + ``` + +You can learn more about the new endpoints in the updated [Collaborators][collaborators] and new [Repository Invitations][repo-invitations] documentation. + +If you have any questions or feedback, please [let us know][contact]. + +[media-type]: /v3/media +[collaborators]: /v3/repos/collaborators +[repo-invitations]: /v3/repos/invitations +[repo-invitations-announcement]: https://github.com/blog/2170-repository-invitations +[contact]: https://github.com/contact?form%5Bsubject%5D=Reactions+Repository+Invitations+API+Preview diff --git a/content/v3/oauth.md b/content/v3/oauth.md index 62cd4711d1..435cd815f8 100644 --- a/content/v3/oauth.md +++ b/content/v3/oauth.md @@ -196,7 +196,7 @@ Name | Description `user:email`| Grants read access to a user's email addresses. `user:follow`| Grants access to follow or unfollow other users. `public_repo`| Grants read/write access to code, commit statuses, collaborators, and deployment statuses for public repositories and organizations. Also required for starring public repositories. -`repo`| Grants read/write access to code, commit statuses, collaborators, and deployment statuses for public and private repositories and organizations. +`repo`| Grants read/write access to code, commit statuses, repository invitations, collaborators, and deployment statuses for public and private repositories and organizations. `repo_deployment`| Grants access to [deployment statuses][deployments] for public and private repositories. This scope is only necessary to grant other users or services access to deployment statuses, *without* granting access to the code. `repo:status`| Grants read/write access to public and private repository commit statuses. This scope is only necessary to grant other users or services access to private repository commit statuses *without* granting access to the code. `delete_repo`| Grants access to delete adminable repositories. diff --git a/content/v3/repos/collaborators.md b/content/v3/repos/collaborators.md index 2f5e94b9aa..15c94f9856 100644 --- a/content/v3/repos/collaborators.md +++ b/content/v3/repos/collaborators.md @@ -69,6 +69,17 @@ Name | Type | Description <%= fetch_content(:optional_put_content_length) %> +{{#tip}} + +We're currently offering a preview period allowing applications to opt in to the Repository Invitations API. + +To send an invitation to a collaborator rather than directly adding them, you must provide a custom [media type](/v3/media) in the `Accept` header: + +``` +application/vnd.github.swamp-thing-preview+json +``` + +{{/tip}} {% if page.version != 'dotcom' and page.version > 2.3 and page.version < 2.6 %} @@ -98,6 +109,11 @@ application/vnd.github.ironman-preview+json <%= headers 204 %> +### Response with preview media type + +<%= headers 200 %> +<%= json(:repository_invitation) { |h| [h] } %> + ## Remove user as a collaborator DELETE /repos/:owner/:repo/collaborators/:username diff --git a/content/v3/repos/invitations.md b/content/v3/repos/invitations.md new file mode 100644 index 0000000000..a9e327754f --- /dev/null +++ b/content/v3/repos/invitations.md @@ -0,0 +1,98 @@ +--- +title: Repository Invitations +--- + +# Repository Invitations + +{{#tip}} + +We're currently offering a preview of the Repository Invitations API. + +To access the API during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header: + +``` +application/vnd.github.swamp-thing-preview+json +``` + +{{/tip}} + +{:toc} + + + +## Invite a user to a repository + +Use the API endpoint for adding a collaborator [here](/v3/repos/collaborators). + + + +## List invitations for a repository + + GET /repositories/:repo_id/invitations + +When authenticating as a user with admin rights to a repository, this endpoint will list all currently open repository invitations. + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:repository_invitation) { |h| [h] } %> + + + +## Delete a repository invitation + + DELETE /repositories/:repo_id/invitations/:invitation_id + +### Response + +<%= headers 204 %> + + + +## Update a repository invitation + + PATCH /repositories/:repo_id/invitations/:invitation_id + +### Input + +Name | Type | Description +-----|------|-------------- +`permissions`|`string` | The permissions that the associated user will have on the repository. Valid values are `read`, `write`, and `admin`. + +### Response + +<%= headers 200 %> +<%= json(:repository_invitation) %> + + + +## List a user's repository invitations + + GET /user/repository_invitations + +When authenticating as a user, this endpoint will list all currently open repository invitations for that user. + +### Response + +<%= headers 200 %> +<%= json(:repository_invitation) { |h| [h] } %> + + + +## Accept a repository invitation + + PATCH /repositories/:repo_id/invitations/:invitation_id + +### Response + +<%= headers 204 %> + + + +## Decline a repository invitation + + DELETE /repositories/:repo_id/invitations/:invitation_id + +### Response + +<%= headers 204 %> diff --git a/layouts/sidebar.html b/layouts/sidebar.html index 54ebad1a7b..bf98850e20 100644 --- a/layouts/sidebar.html +++ b/layouts/sidebar.html @@ -106,6 +106,7 @@

Deployments
  • Downloads
  • Forks
  • +
  • Invitations
  • Merging
  • Pages
  • Releases
  • diff --git a/lib/responses/repos.rb b/lib/responses/repos.rb index 3f1dfc5c9d..843e942420 100644 --- a/lib/responses/repos.rb +++ b/lib/responses/repos.rb @@ -134,6 +134,18 @@ module Responses [0,1,43], [0,2,21] ] + + REPOSITORY_INVITATION ||= { + "id" => 1, + "repository" => REPO, + "invitee" => USER, + "inviter" => USER, + "permissions" => "write", + "created_at" => "2016-06-13T14:52:50-05:00", + "url" => "https://api.github.com/api/v3/repositories/1296269/invitations/", + "html_url" => "#{SIMPLE_REPO['html_url']}/invitations" + } + end end end From 221e99b9e319f3d6713ed44f2b43a9dc98b5c0a3 Mon Sep 17 00:00:00 2001 From: Hubot Date: Thu, 16 Jun 2016 06:41:04 -0700 Subject: [PATCH 05/54] Sync changes from upstream repository --- content/changes/2016-06-14-repository-invitations.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/content/changes/2016-06-14-repository-invitations.md b/content/changes/2016-06-14-repository-invitations.md index 5d39cdf46c..1c043cf991 100644 --- a/content/changes/2016-06-14-repository-invitations.md +++ b/content/changes/2016-06-14-repository-invitations.md @@ -11,11 +11,11 @@ We have now have endpoints for managing repository invitations for both reposito For example: - ``` command-line - curl "https://api.github.com/api/v3/repositories/1313/invitations" \ - -H 'Authorization: token TOKEN' \ - -H "Accept: application/vnd.github.swamp-thing-preview" \ - ``` +``` command-line +curl "https://api.github.com/api/v3/repositories/1313/invitations" \ + -H 'Authorization: token TOKEN' \ + -H "Accept: application/vnd.github.swamp-thing-preview" \ +``` You can learn more about the new endpoints in the updated [Collaborators][collaborators] and new [Repository Invitations][repo-invitations] documentation. From 397d4b5117a3a912d801819383d237f5efa33b02 Mon Sep 17 00:00:00 2001 From: Hubot Date: Thu, 16 Jun 2016 08:43:32 -0700 Subject: [PATCH 06/54] Sync changes from upstream repository --- content/changes/2016-06-14-repository-invitations.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/changes/2016-06-14-repository-invitations.md b/content/changes/2016-06-14-repository-invitations.md index 1c043cf991..f02f5c1f11 100644 --- a/content/changes/2016-06-14-repository-invitations.md +++ b/content/changes/2016-06-14-repository-invitations.md @@ -25,4 +25,4 @@ If you have any questions or feedback, please [let us know][contact]. [collaborators]: /v3/repos/collaborators [repo-invitations]: /v3/repos/invitations [repo-invitations-announcement]: https://github.com/blog/2170-repository-invitations -[contact]: https://github.com/contact?form%5Bsubject%5D=Reactions+Repository+Invitations+API+Preview +[contact]: https://github.com/contact?form%5Bsubject%5D=Repository+Invitations+API+Preview From 094b17ce10f8d2e3d5807478e5b4bfc59f840c23 Mon Sep 17 00:00:00 2001 From: Hubot Date: Thu, 16 Jun 2016 10:53:11 -0700 Subject: [PATCH 07/54] Sync changes from upstream repository --- content/v3/repos/invitations.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/content/v3/repos/invitations.md b/content/v3/repos/invitations.md index a9e327754f..6ba3c9326e 100644 --- a/content/v3/repos/invitations.md +++ b/content/v3/repos/invitations.md @@ -18,11 +18,11 @@ application/vnd.github.swamp-thing-preview+json {:toc} - + -## Invite a user to a repository +## Invite a user to a repository -Use the API endpoint for adding a collaborator [here](/v3/repos/collaborators). +Use the API endpoint for adding a collaborator [here](/v3/repos/collaborators). @@ -81,7 +81,7 @@ When authenticating as a user, this endpoint will list all currently open reposi ## Accept a repository invitation - PATCH /repositories/:repo_id/invitations/:invitation_id + PATCH /user/repository_invitations/:invitation_id ### Response @@ -91,7 +91,7 @@ When authenticating as a user, this endpoint will list all currently open reposi ## Decline a repository invitation - DELETE /repositories/:repo_id/invitations/:invitation_id + DELETE /user/repository_invitations/:invitation_id ### Response From c9054d2c8708b97f11ac43a1dbf7f9b20a6b49ae Mon Sep 17 00:00:00 2001 From: Pavan Ravipati Date: Thu, 16 Jun 2016 14:27:55 -0700 Subject: [PATCH 08/54] Fix capitalization for "pull request" --- content/guides/delivering-deployments.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/content/guides/delivering-deployments.md b/content/guides/delivering-deployments.md index 218cadfd9b..cc303407e4 100644 --- a/content/guides/delivering-deployments.md +++ b/content/guides/delivering-deployments.md @@ -14,9 +14,9 @@ the moment your code lands on `master`. This guide will use that API to demonstrate a setup that you can use. In our scenario, we will: -* Merge a Pull Request -* When the CI is finished, we'll set the Pull Request's status accordingly. -* When the Pull Request is merged, we'll run our deployment to our server. +* Merge a pull request +* When the CI is finished, we'll set the pull request's status accordingly. +* When the pull request is merged, we'll run our deployment to our server. Our CI system and host server will be figments of our imagination. They could be Heroku, Amazon, or something else entirely. The crux of this guide will be setting up @@ -50,7 +50,7 @@ Start this server up. By default, Sinatra starts on port `4567`, so you'll want to configure ngrok to start listening for that, too. In order for this server to work, we'll need to set a repository up with a webhook. -The webhook should be configured to fire whenever a Pull Request is created, or merged. +The webhook should be configured to fire whenever a pull request is created, or merged. Go ahead and create a repository you're comfortable playing around in. Might we suggest [@octocat's Spoon/Knife repository](https://github.com/octocat/Spoon-Knife)? After that, you'll create a new webhook in your repository, feeding it the URL @@ -64,10 +64,10 @@ Great! Click on **Let me select individual events.**, and select the following: * Deployment * Deployment status -* Pull Request +* pull request These are the events {{ site.data.variables.product.product_name }} will send to our server whenever the relevant action -occurs. We'll configure our server to *just* handle when Pull Requests are merged +occurs. We'll configure our server to *just* handle when pull requests are merged right now: ``` ruby From d7502f61c087d23b4325e2285e195fa227f1acc6 Mon Sep 17 00:00:00 2001 From: Pavan Ravipati Date: Thu, 16 Jun 2016 14:33:32 -0700 Subject: [PATCH 09/54] Recapitalize pull request when referred to as a feature --- content/guides/delivering-deployments.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/guides/delivering-deployments.md b/content/guides/delivering-deployments.md index cc303407e4..9d50dd5527 100644 --- a/content/guides/delivering-deployments.md +++ b/content/guides/delivering-deployments.md @@ -64,7 +64,7 @@ Great! Click on **Let me select individual events.**, and select the following: * Deployment * Deployment status -* pull request +* Pull Request These are the events {{ site.data.variables.product.product_name }} will send to our server whenever the relevant action occurs. We'll configure our server to *just* handle when pull requests are merged From 95609e61ebef9634d0613e6828e00986d068ce28 Mon Sep 17 00:00:00 2001 From: Jakub Wilk Date: Sat, 18 Jun 2016 19:40:48 +0200 Subject: [PATCH 10/54] Fix spelling of "etc." --- content/guides/delivering-deployments.md | 2 +- content/v3/troubleshooting.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/content/guides/delivering-deployments.md b/content/guides/delivering-deployments.md index 218cadfd9b..7b155155e9 100644 --- a/content/guides/delivering-deployments.md +++ b/content/guides/delivering-deployments.md @@ -138,7 +138,7 @@ the output. First, let's complete our `process_deployment` method: ``` ruby def process_deployment payload = JSON.parse(@payload['payload']) - # you can send this information to your chat room, monitor, pager, e.t.c. + # you can send this information to your chat room, monitor, pager, etc. puts "Processing '#{@payload['description']}' for #{payload['deploy_user']} to #{payload['environment']}" sleep 2 # simulate work @client.create_deployment_status("repos/#{@payload['repository']['full_name']}/deployments/#{@payload['id']}", 'pending') diff --git a/content/v3/troubleshooting.md b/content/v3/troubleshooting.md index 9536fd7373..09a0d04864 100644 --- a/content/v3/troubleshooting.md +++ b/content/v3/troubleshooting.md @@ -20,7 +20,7 @@ To troubleshoot, ensure [you're authenticating correctly](/guides/getting-starte ## Why am I not seeing all my results? -Most API calls accessing a list of resources (_e.g._, users, issues, _e.t.c._) support +Most API calls accessing a list of resources (_e.g._, users, issues, _etc._) support pagination. If you're making requests and receiving an incomplete set of results, you're probably only seeing the first page. You'll need to request the remaining pages in order to get more results. From f62a21455e1c034ed6fa36e79ece18ea3f80d59a Mon Sep 17 00:00:00 2001 From: Dmitri Shuralyov Date: Sun, 19 Jun 2016 20:16:46 -0700 Subject: [PATCH 11/54] Fix formatting of Decline a repository invitation endpoint. --- content/v3/repos/invitations.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/v3/repos/invitations.md b/content/v3/repos/invitations.md index 6ba3c9326e..50469923aa 100644 --- a/content/v3/repos/invitations.md +++ b/content/v3/repos/invitations.md @@ -91,7 +91,7 @@ When authenticating as a user, this endpoint will list all currently open reposi ## Decline a repository invitation - DELETE /user/repository_invitations/:invitation_id + DELETE /user/repository_invitations/:invitation_id ### Response From 59834eabf16f4bb592510fe2ff9734f58c0cba5f Mon Sep 17 00:00:00 2001 From: Hubot Date: Wed, 22 Jun 2016 16:01:27 -0700 Subject: [PATCH 12/54] Sync changes from upstream repository --- ...2016-06-22-issue-locking-api-is-now-official.md | 14 ++++++++++++++ content/v3/issues.md | 7 +++++-- 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 content/changes/2016-06-22-issue-locking-api-is-now-official.md diff --git a/content/changes/2016-06-22-issue-locking-api-is-now-official.md b/content/changes/2016-06-22-issue-locking-api-is-now-official.md new file mode 100644 index 0000000000..432a14a0a5 --- /dev/null +++ b/content/changes/2016-06-22-issue-locking-api-is-now-official.md @@ -0,0 +1,14 @@ +--- +title: Issue locking and unlocking APIs are now official +author_name: davidcelis +--- + +We're making the [Issue locking and unlocking APIs][issue-locking-blog-post] part of the official GitHub API. + +During the preview period you needed to provide the `application/vnd.github.the-key-preview+sha` preview media type in the `Accept` header to opt-in to the new endpoints. Now that the preview period has ended, you no longer need to specify this custom [media type][custom-media-types]. + +If you have any questions or feedback, please [get in touch with us][contact]! + +[issue-locking-blog-post]: /changes/2016-02-11-issue-locking-api/ +[custom-media-types]: /v3/media/ +[contact]: https://github.com/contact?form[subject]=Issue+Locking+and+Unlocking+API diff --git a/content/v3/issues.md b/content/v3/issues.md index dbc5f8ef7b..e2f9b9f5f4 100644 --- a/content/v3/issues.md +++ b/content/v3/issues.md @@ -283,10 +283,10 @@ The `assignees` key will only be present in issue payloads if this header is pas {{/tip}} {% endif %} -{% if page.version == 'dotcom' %} - +{% if page.version == 'dotcom' or page.version >= 2.6 %} ## Lock an issue +{% if page.version == 2.6 %} {{#tip}} @@ -300,6 +300,7 @@ The `assignees` key will only be present in issue payloads if this header is pas application/vnd.github.the-key-preview+json {{/tip}} +{% endif %} Users with push access can lock an issue's conversation. @@ -313,6 +314,7 @@ Users with push access can lock an issue's conversation. ## Unlock an issue +{% if page.version == 2.6 %} {{#tip}} @@ -326,6 +328,7 @@ Users with push access can lock an issue's conversation. application/vnd.github.the-key-preview+json {{/tip}} +{% endif %} Users with push access can unlock an issue's conversation. From 145091012d885ab720571a5fb7909b00f199a4b3 Mon Sep 17 00:00:00 2001 From: Hubot Date: Sat, 25 Jun 2016 17:48:57 -0700 Subject: [PATCH 13/54] Sync changes from upstream repository --- content/v3/repos/collaborators.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/v3/repos/collaborators.md b/content/v3/repos/collaborators.md index 15c94f9856..726a9d84da 100644 --- a/content/v3/repos/collaborators.md +++ b/content/v3/repos/collaborators.md @@ -111,7 +111,7 @@ application/vnd.github.ironman-preview+json ### Response with preview media type -<%= headers 200 %> +<%= headers 201 %> <%= json(:repository_invitation) { |h| [h] } %> ## Remove user as a collaborator From 6f4a515a07f36069261ee6cfba7f91c66e4d5fd6 Mon Sep 17 00:00:00 2001 From: Hubot Date: Sat, 25 Jun 2016 18:05:55 -0700 Subject: [PATCH 14/54] Sync changes from upstream repository --- content/v3/repos/collaborators.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/v3/repos/collaborators.md b/content/v3/repos/collaborators.md index 726a9d84da..5bd3ad05b4 100644 --- a/content/v3/repos/collaborators.md +++ b/content/v3/repos/collaborators.md @@ -112,7 +112,7 @@ application/vnd.github.ironman-preview+json ### Response with preview media type <%= headers 201 %> -<%= json(:repository_invitation) { |h| [h] } %> +<%= json(:repository_invitation) %> ## Remove user as a collaborator From b403633f4b51e3bbb25da88aced2e3ae0c696a7a Mon Sep 17 00:00:00 2001 From: Hubot Date: Mon, 27 Jun 2016 02:03:48 -0700 Subject: [PATCH 15/54] Sync changes from upstream repository --- assets/javascripts/initial.js | 10 + .../2014-03-18-paginating-method-changes.md | 2 +- .../2015-11-11-protected-branches-api.md | 4 +- ...016-06-27-protected-branches-api-update.md | 22 + content/v3/repos.md | 116 ---- content/v3/repos/branches.md | 522 ++++++++++++++++++ layouts/sidebar.html | 1 + lib/redirect_generator.rb | 2 +- lib/responses/git.rb | 14 - lib/responses/repos.rb | 21 + spec/spec_helper.rb | 2 +- 11 files changed, 582 insertions(+), 134 deletions(-) create mode 100644 content/changes/2016-06-27-protected-branches-api-update.md create mode 100644 content/v3/repos/branches.md diff --git a/assets/javascripts/initial.js b/assets/javascripts/initial.js index 08467f032a..be7d49d2fd 100644 --- a/assets/javascripts/initial.js +++ b/assets/javascripts/initial.js @@ -1,8 +1,18 @@ // before anything happens, check if this is a versionless enterprise URL path = window.location.pathname; +hash = window.location.hash; paths = path.split("/"); if (paths[1] == "enterprise" && (paths[2].length === 0 || isNaN(paths[2]))) { paths.splice(2, 0, String({{ site.version }})); suffix = window.location.search || window.location.hash; window.location.href = window.location.protocol + "//" + window.location.host + paths.join("/") + suffix; } +if (path == "/v3/repos/" && hash == "#enabling-and-disabling-branch-protection") { + window.location.href = "/v3/repos/branches/#get-branch-protection"; +} +if (path == "/v3/repos/" && hash == "#list-branches") { + window.location.href = "/v3/repos/branches/#list-branches"; +} +if (path == "/v3/repos/" && hash == "#get-branch") { + window.location.href = "/v3/repos/branches/#get-branch"; +} diff --git a/content/changes/2014-03-18-paginating-method-changes.md b/content/changes/2014-03-18-paginating-method-changes.md index 7909758b7e..9cba74b8db 100644 --- a/content/changes/2014-03-18-paginating-method-changes.md +++ b/content/changes/2014-03-18-paginating-method-changes.md @@ -119,7 +119,7 @@ Here's the complete list of updated methods: [Pull Request files]: /v3/pulls/#list-pull-requests-files [Release assets]: /v3/repos/releases/#list-assets-for-a-release [Repository contributors]: /v3/repos/#list-contributors -[Repository branches]: /v3/repos/#list-branches +[Repository branches]: /v3/repos/branches/#list-branches [Repository tags]: /v3/repos/#list-tags [Repository teams]: /v3/repos/#list-teams [Team members]: /v3/orgs/teams/#list-team-members diff --git a/content/changes/2015-11-11-protected-branches-api.md b/content/changes/2015-11-11-protected-branches-api.md index 3510ed9866..6b09f0ac9b 100644 --- a/content/changes/2015-11-11-protected-branches-api.md +++ b/content/changes/2015-11-11-protected-branches-api.md @@ -3,6 +3,8 @@ title: Protected Branches API Preview Period author_name: nakajima --- +**UPDATE (2016-06-27):** As [announced](/changes/2016-06-27-protected-branches-api-update/), there is an extended version of the protected branches API available. This older version will be removed once the new one becomes official. + We're starting a preview period for the [protected branches](https://github.com/blog/2051-protected-branches-and-required-status-checks) API. Protecting a branch prevents force-pushes to it as well as deleting it. You can also specify required status checks that are required to merge code into the branch. To protect a branch, make a `PATCH` request to the URL of the branch: @@ -33,6 +35,6 @@ To access this functionality during the preview period, you’ll need to provide application/vnd.github.loki-preview+json ``` -Take a look at [the docs here](/v3/repos/#enabling-and-disabling-branch-protection). +Take a look at [the docs here](/v3/repos/branches/). If you have any questions, please [get in touch](https://github.com/contact?form%5Bsubject%5D=Protected+Branches+API+Preview). diff --git a/content/changes/2016-06-27-protected-branches-api-update.md b/content/changes/2016-06-27-protected-branches-api-update.md new file mode 100644 index 0000000000..6ce7053298 --- /dev/null +++ b/content/changes/2016-06-27-protected-branches-api-update.md @@ -0,0 +1,22 @@ +--- +title: Update to Protected Branches API Preview +author_name: tma +--- + +Over the past few months, we've made a few [improvements](https://github.com/blog/2137-protected-branches-improvements) to the way [protected branches](https://github.com/blog/2051-protected-branches-and-required-status-checks) work in our web interface. Today, we're modifying the protected branches API [preview period](https://developer.github.com/changes/2015-11-11-protected-branches-api/) to include these improvements. + +Included in these API changes is the ability to allow organizations to specify which members and teams should be able to push to a protected branch, as well as providing a new setting for required status checks which will remove the requirement of a pull request to be up to date before merging. + +You'll notice a new endpoint structure. One set of endpoints for modifying the branch settings as a whole (`PATCH /repos/:owner/:repo/branches/:branch` has been updated to be `PUT /repos/:owner/:repo/branches/:branch/protection`), and a series of more granular endpoints to modify a subset of the branch protection settings. + +**This will be a breaking change for the protected branch API.** The deprecated API endpoint will be removed when the protected branches API will leave the preview period. If you're trying out the old protected branches API, you'll need to update your code. + +#### How can I try it? + +To access this functionality during the preview period, you’ll need to provide the following custom media type in the Accept header: + +``` +application/vnd.github.loki-preview+json +``` + +Take a look at [the docs here](/v3/repos/branches/). If you have any questions, please [get in touch](https://github.com/contact?form%5Bsubject%5D=Protected+Branches+API+Preview). diff --git a/content/v3/repos.md b/content/v3/repos.md index e4f1240ddf..2e8b726228 100644 --- a/content/v3/repos.md +++ b/content/v3/repos.md @@ -250,122 +250,6 @@ List languages for the specified repository. The value on the right of a languag <%= headers 200, :pagination => default_pagination_rels %> <%= json(:tag) { |h| [h] } %> -## List Branches - - GET /repos/:owner/:repo/branches - -### Parameters - -Name | Type | Description ------|------|------------- -`protected`|`string` | Set to `1` or `true` to only return protected branches. - -{{#tip}} - - - - The `protected` parameter is currently available for developers to preview. - During the preview period, the API may change without advance notice. - Please see the [blog post](/changes/2015-11-11-protected-branches-api) for full details. - - To access the API during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header: - - application/vnd.github.loki-preview+json - - The `protection` key will only be present in branch payloads if this header is passed. - -{{/tip}} - -### Response - -<%= headers 200, :pagination => default_pagination_rels %> -<%= json(:branches) %> - -## Get Branch - - GET /repos/:owner/:repo/branches/:branch - -### Response - -{{#tip}} - - - - The Protected Branch API is currently available for developers to preview. - During the preview period, the API may change without advance notice. - Please see the [blog post](/changes/2015-11-11-protected-branches-api) for full details. - - To access the API during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header: - - application/vnd.github.loki-preview+json - - The `protection` key will only be present in branch payloads if this header is passed. - -{{/tip}} - -<%= headers 200 %> -<%= json(:branch) %> - -{% if page.version == 'dotcom' or page.version >= 2.5 %} - -## Enabling and disabling branch protection - -{{#tip}} - - - - The Protected Branch API is currently available for developers to preview. - During the preview period, the API may change without advance notice. - Please see the [blog post](/changes/2015-11-11-protected-branches-api) for full details. - - To access the API during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header: - - application/vnd.github.loki-preview+json - -{{/tip}} - -Protecting a branch requires admin access. - - PATCH /repos/:owner/:repo/branches/:branch - -### Input - -You need to pass a `protection` object. - -Name | Type | Description ------|------|------------- -`enabled`|`boolean` | **Required**. Should this branch be protected or not -`required_status_checks`|`object`| Configure required status checks here - -The `required_status_checks` object must have the following keys: - -Name | Type | Description ------|------|------------- -`enforcement_level`|`string` | **Required**. Who required status checks apply to. Options are `off`, `non_admins` or `everyone`. -`contexts`|`array` | **Required**. The list of status checks to require in order to merge into this branch - -The `enforcement_level` key can have the following values: - -Name | Description -------|------------ -`off` | Turn off required status checks for this branch. -`non_admins` | Required status checks will be enforced for non-admins. -`everyone` | Required status checks will be enforced for everyone (including admins). - -#### Example - -<%= json \ - "protection" => { - "enabled" => true, - "required_status_checks" => { - "enforcement_level" => "everyone", - "contexts" => ["continuous-integration/travis-ci"] - } - } -%> - -{% endif %} - ## Delete a Repository Deleting a repository requires admin access. If OAuth is used, the diff --git a/content/v3/repos/branches.md b/content/v3/repos/branches.md new file mode 100644 index 0000000000..1c11628394 --- /dev/null +++ b/content/v3/repos/branches.md @@ -0,0 +1,522 @@ +--- +title: Branches +--- + +# Branches + +{:toc} + +{% if page.version != 'dotcom' and page.version >= 2.5 and page.version < 2.7 %} + +## List Branches + + GET /repos/:owner/:repo/branches + +### Parameters + +Name | Type | Description +-----|------|------------- +`protected`| `boolean` | Set to `true` to only return protected branches + +{{#tip}} + + + + The Protected Branch API is currently available for developers to preview. + During the preview period, the API may change without advance notice. + Please see the [blog post](/changes/2015-11-11-protected-branches-api) for full details. + + To access the API during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header: + + application/vnd.github.loki-preview+json + + The `protection` key will only be present in branch payloads if this header is passed. + +{{/tip}} + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:branches) { |a| a.each { |b| b.merge!("protection" => { + "enabled" => false, + "required_status_checks" => { + "enforcement_level" => "off", + "contexts" => [] + } +}) } } %> + +## Get Branch + + GET /repos/:owner/:repo/branches/:branch + +### Response + +{{#tip}} + + + + The Protected Branch API is currently available for developers to preview. + During the preview period, the API may change without advance notice. + Please see the [blog post](/changes/2015-11-11-protected-branches-api) for full details. + + To access the API during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header: + + application/vnd.github.loki-preview+json + + The `protection` key will only be present in branch payloads if this header is passed. + +{{/tip}} + +<%= headers 200 %> +<%= json(:branch) { |h| h.merge!("protection" => { + "enabled" => false, + "required_status_checks" => { + "enforcement_level" => "off", + "contexts" => [] + } +}) } %> + +## Enabling and disabling branch protection + +{{#tip}} + + + + The Protected Branch API is currently available for developers to preview. + During the preview period, the API may change without advance notice. + Please see the [blog post](/changes/2015-11-11-protected-branches-api) for full details. + + To access the API during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header: + + application/vnd.github.loki-preview+json + +{{/tip}} + +Protecting a branch requires admin access. + + PATCH /repos/:owner/:repo/branches/:branch + +### Parameters + +You need to pass a `protection` object. + +Name | Type | Description +-----|------|------------- +`enabled`|`boolean` | **Required**. Should this branch be protected or not +`required_status_checks`|`object`| Configure required status checks here + +The `required_status_checks` object must have the following keys: + +Name | Type | Description +-----|------|------------- +`enforcement_level`|`string` | **Required**. Who required status checks apply to. Options are `off`, `non_admins` or `everyone`. +`contexts`|`array` | **Required**. The list of status checks to require in order to merge into this branch + +The `enforcement_level` key can have the following values: + +Name | Description +------|------------ +`off` | Turn off required status checks for this branch. +`non_admins` | Required status checks will be enforced for non-admins. +`everyone` | Required status checks will be enforced for everyone (including admins). + +#### Example + +<%= json \ + "protection" => { + "enabled" => true, + "required_status_checks" => { + "enforcement_level" => "everyone", + "contexts" => ["continuous-integration/travis-ci"] + } + } +%> + +{% endif %} + +{% if page.version == 'dotcom' or page.version >= 2.7 %} + +{{#tip}} + + + + The Protected Branch API is currently available for developers to preview. + During the preview period, the API may change without advance notice. + Please see the [blog post](/changes/2016-06-27-protected-branches-api-update) for full details. + + To access the API during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header: + + application/vnd.github.loki-preview+json + +{{/tip}} + +## List Branches + + GET /repos/:owner/:repo/branches + +### Parameters + +Name | Type | Description +-----|------|------------- +`protected` | `boolean` | Set to `true` to only return protected branches + +{{#tip}} + + + + The Protected Branch API is currently available for developers to preview. + During the preview period, the API may change without advance notice. + Please see the [blog post](/changes/2016-06-27-protected-branches-api-update) for full details. + + To access the API during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header: + + application/vnd.github.loki-preview+json + + The `protected` key will only be present in branch payloads if this header is passed. + +{{/tip}} + +### Response + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json(:branches) { |a| a.each { |b| b.merge!( + "protected": true, + "protection_url": "https://api.github.com/repos/octocat/Hello-World/branches/#{b["name"]}/protection", +) } } %> + +## Get Branch + + GET /repos/:owner/:repo/branches/:branch + +### Response + +{{#tip}} + + + + The Protected Branch API is currently available for developers to preview. + During the preview period, the API may change without advance notice. + Please see the [blog post](/changes/2016-06-27-protected-branches-api-update) for full details. + + To access the API during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header: + + application/vnd.github.loki-preview+json + + The `protected` key will only be present in branch payloads if this header is passed. + +{{/tip}} + +<%= headers 200 %> +<%= json(:branch) { |h| h.merge!( + "protected": true, + "protection_url": "https://api.github.com/repos/octocat/Hello-World/branches/#{h["name"]}/protection", +) } %> + + +## Get branch protection + + GET /repos/:owner/:repo/branches/:branch/protection + +<%= headers 200 %> +<%= json(:repo_branch_protection) %> + +## Update branch protection + +Protecting a branch requires admin access. + + PUT /repos/:owner/:repo/branches/:branch/protection + +### Parameters + +You can pass two objects: `required_status_checks` and `restrictions`. Both can have the value `null` for disabled. + +The `required_status_checks` object must have the following keys: + +Name | Type | Description +-----|------|------------- +`include_admins` | `boolean` | **Required**. Enforce required status checks for repository administrators. +`strict` | `boolean` | **Required**. Require branches to be up to date before merging. +`contexts` | `array` | **Required**. The list of status checks to require in order to merge into this branch + +The `restrictions` object must have the following keys: + +Name | Type | Description +-----|------|------------- +`users` | `array` | The list of user `login`s with push access +`teams` | `array` | The list of team `slug`s with push access + +{{#tip}} + +* Teams and users `restrictions` are only available for organization-owned repositories. +* The list of users and teams in total is limited to 100 items. + +{{/tip}} + +### Example + +<%= json \ + "required_status_checks" => { + "include_admins" => true, + "strict" => true, + "contexts" => ["continuous-integration/travis-ci"] + }, + "restrictions" => { + "users" => ["octocat"], + "teams" => ["justice-league"] + } +%> + +### Response + +<%= headers 200 %> +<%= json(:repo_branch_protection) %> + +## Remove branch protection + + DELETE /repos/:owner/:repo/branches/:branch/protection + +<%= headers 204 %> + +## Get required status checks of protected branch + + GET /repos/:owner/:repo/branches/:branch/protection/required_status_checks + +<%= headers 200 %> +<%= json(:repo_branch_protection_required_status_checks) %> + +## Update required status checks of protected branch + +Updating required status checks requires admin access and branch protection to be enabled. + + PATCH /repos/:owner/:repo/branches/:branch/protection/required_status_checks + +### Parameters + +The object passed can have the following keys: + +Name | Type | Description +-----|------|------------- +`include_admins`|`boolean` | Enforce required status checks for repository administrators. +`strict`|`boolean` | Require branches to be up to date before merging. +`contexts`|`array` | The list of status checks to require in order to merge into this branch + +### Example + +<%= json \ + "include_admins" => true, + "strict" => true, + "contexts" => ["continuous-integration/travis-ci"] +%> + +### Response + +<%= headers 200 %> +<%= json(:repo_branch_protection_required_status_checks) %> + +## Remove required status checks of protected branch + + DELETE /repos/:owner/:repo/branches/:branch/protection/required_status_checks + +<%= headers 204 %> + +## List required status checks contexts of protected branch + + GET /repos/:owner/:repo/branches/:branch/protection/required_status_checks/contexts + +<%= headers 200 %> +<%= json ["continuous-integration/travis-ci"] %> + +## Replace required status checks contexts of protected branch + + PUT /repos/:owner/:repo/branches/:branch/protection/required_status_checks/contexts + +### Example + +<%= json ["continuous-integration/travis-ci"] %> + +### Response + +<%= headers 200 %> +<%= json ["continuous-integration/travis-ci"] %> + +## Add required status checks contexts of protected branch + + POST /repos/:owner/:repo/branches/:branch/protection/required_status_checks/contexts + +### Example + +<%= json ["continuous-integration/jenkins"] %> + +### Response + +<%= headers 200 %> +<%= json ["continuous-integration/travis-ci", "continuous-integration/jenkins"] %> + +## Remove required status checks contexts of protected branch + + DELETE /repos/:owner/:repo/branches/:branch/protection/required_status_checks/contexts + +### Example + +<%= json ["continuous-integration/jenkins"] %> + +### Response + +<%= headers 200 %> +<%= json ["continuous-integration/travis-ci"] %> + + +## Get restrictions of protected branch + +{{#tip}} + +Teams and users `restrictions` are only available for organization-owned repositories. + +{{/tip}} + + GET /repos/:owner/:repo/branches/:branch/protection/restrictions + +<%= headers 200 %> +<%= json(:repo_branch_protection_restrictions) %> + +## Remove restrictions of protected branch + + DELETE /repos/:owner/:repo/branches/:branch/protection/restrictions + +<%= headers 204 %> + +## List team restrictions of protected branch + + GET /repos/:owner/:repo/branches/:branch/protection/restrictions/teams + +<%= headers 200 %> +<%= json(:team) { |h| [h] } %> + +## Replace team restrictions of protected branch + + PUT /repos/:owner/:repo/branches/:branch/protection/restrictions/teams + +### Body parameters + +Pass the list of team `slug`s with push access. + +{{#tip}} + + The list of users and teams in total is limited to 100 items. + +{{/tip}} + +### Example + +<%= json ["justice-league"] %> + +### Response + +<%= headers 200 %> +<%= json(:team) { |h| [h] } %> + +## Add team restrictions of protected branch + + POST /repos/:owner/:repo/branches/:branch/protection/restrictions/teams + +### Body parameters + +Pass the list of team `slug`s with push access. + +{{#tip}} + +The list of users and teams in total is limited to 100 items. + +{{/tip}} + +### Example + +<%= json ["justice-league"] %> + +### Response + +<%= headers 200 %> +<%= json(:team) { |h| [h] } %> + +## Remove team restrictions of protected branch + + DELETE /repos/:owner/:repo/branches/:branch/protection/restrictions/teams + +### Example + +<%= json ["octocats"] %> + +### Response + +<%= headers 200 %> +<%= json(:team) { |h| [h] } %> + + +## List user restrictions of protected branch + + GET /repos/:owner/:repo/branches/:branch/protection/restrictions/users + +<%= headers 200 %> +<%= json(:user) { |h| [h] } %> + +## Replace user restrictions of protected branch + + PUT /repos/:owner/:repo/branches/:branch/protection/restrictions/users + +### Body parameters + +Pass the list of user `login`s with push access. + +{{#tip}} + +The list of users and teams in total is limited to 100 items. + +{{/tip}} + +### Example + +<%= json ["octocat"] %> + +### Response + +<%= headers 200 %> +<%= json(:user) { |h| [h] } %> + +## Add user restrictions of protected branch + + POST /repos/:owner/:repo/branches/:branch/protection/restrictions/users + +### Body parameters + +Pass the list of user `login`s with push access. + +{{#tip}} + +The list of users and teams in total is limited to 100 items. + +{{/tip}} + +### Example + +<%= json ["octocat"] %> + +### Response + +<%= headers 200 %> +<%= json(:user) { |h| [h] } %> + +## Remove user restrictions of protected branch + + DELETE /repos/:owner/:repo/branches/:branch/protection/restrictions/users + +### Example + +<%= json ["defunkt"] %> + +### Response + +<%= headers 200 %> +<%= json(:user) { |h| [h] } %> + + +{% endif %} diff --git a/layouts/sidebar.html b/layouts/sidebar.html index bf98850e20..31ce45610c 100644 --- a/layouts/sidebar.html +++ b/layouts/sidebar.html @@ -98,6 +98,7 @@

    Repositories

      +
    • Branches
    • Collaborators
    • Comments
    • Commits
    • diff --git a/lib/redirect_generator.rb b/lib/redirect_generator.rb index 6d33ec5043..7472838137 100644 --- a/lib/redirect_generator.rb +++ b/lib/redirect_generator.rb @@ -2,7 +2,7 @@ module RedirectGenerator def generate_redirects(redirects) redirects.each do |pairs| pairs.each_pair do |old_url, new_url| - filename = old_url.to_s.sub(/\/$/, '') + filename = old_url.to_s.sub(%r{/$}, '') @items.create( "<%= renderp '/redirect.*', { :new_url => '#{new_url}' diff --git a/lib/responses/git.rb b/lib/responses/git.rb index ab4e20f637..a74100f679 100644 --- a/lib/responses/git.rb +++ b/lib/responses/git.rb @@ -20,25 +20,11 @@ module Responses "commit" => { "sha" => "6dcb09b5b57875f334f61aebed695e2e4193db5e", "url" => "https://api.github.com/repos/octocat/Hello-World/commits/c5b97d5ae6c19d5c5df71a34c7fbeeda2479ccbc" - }, - "protection" => { - "enabled" => false, - "required_status_checks" => { - "enforcement_level" => "off", - "contexts" => [] - } } } ] BRANCH ||= {"name"=>"master", - "protection" => { - "enabled" => false, - "required_status_checks" => { - "enforcement_level" => "off", - "contexts" => [] - } - }, "commit"=> {"sha"=>"7fd1a60b01f91b314f59955a4e4d4e80d8edf11d", "commit"=> diff --git a/lib/responses/repos.rb b/lib/responses/repos.rb index 843e942420..f2d1071867 100644 --- a/lib/responses/repos.rb +++ b/lib/responses/repos.rb @@ -146,6 +146,27 @@ module Responses "html_url" => "#{SIMPLE_REPO['html_url']}/invitations" } + REPO_BRANCH_PROTECTION_RESTRICTIONS ||= { + "url" => "https://api.github.com/repos/octocat/Hello-World/branches/master/protection/restrictions", + "users_url" => "https://api.github.com/repos/octocat/Hello-World/branches/master/protection/restrictions/users", + "teams_url" => "https://api.github.com/repos/octocat/Hello-World/branches/master/protection/restrictions/teams", + "users" => [USER], + "teams" => [TEAM] + } + + REPO_BRANCH_PROTECTION_REQUIRED_STATUS_CHECKS ||= { + "url" => "https://api.github.com/repos/octocat/Hello-World/branches/master/protection/required_status_checks", + "include_admins" => true, + "strict" => true, + "contexts" => ["continuous-integration/travis-ci"], + "contexts_url" => "https://api.github.com/repos/octocat/Hello-World/branches/master/protection/required_status_checks/contexts" + } + + REPO_BRANCH_PROTECTION ||= { + "url" => "https://api.github.com/repos/octocat/Hello-World/branches/master/protection", + "required_status_checks" => REPO_BRANCH_PROTECTION_REQUIRED_STATUS_CHECKS, + "restrictions" => REPO_BRANCH_PROTECTION_RESTRICTIONS + } end end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 9902a40952..adc4095742 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -18,7 +18,7 @@ def posts return @posts if defined? @posts - diffable_files = `git diff -z --name-only --diff-filter=ACMRTUXB origin/master`.split("\0") + diffable_files = `git diff -z --name-only --diff-filter=ACRTUXB origin/master -- content/changes/`.split("\0") @posts = diffable_files.select do |filename| ext = File.extname(filename) From 4eb59b8ad21fac98ec105050ff05d0323779ac7f Mon Sep 17 00:00:00 2001 From: Hubot Date: Wed, 29 Jun 2016 04:56:45 -0700 Subject: [PATCH 16/54] Sync changes from upstream repository --- content/v3/issues/assignees.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/v3/issues/assignees.md b/content/v3/issues/assignees.md index e6e1f8927f..139a98f98c 100644 --- a/content/v3/issues/assignees.md +++ b/content/v3/issues/assignees.md @@ -64,7 +64,7 @@ This call adds the users passed in the `assignees` key (as their logins) to the ### Response <%= headers 201 %> -<%= json(:issue_with_assignees) { |h| [h] } %> +<%= json :issue_with_assignees %> ## Remove assignees from an Issue @@ -93,4 +93,4 @@ This call removes the users passed in the `assignees` key (as their logins) from ### Response <%= headers 200 %> -<%= json(:issue_with_assignees) { |h| [h] } %> +<%= json :issue_with_assignees %> From 1dc6b725fbde3b358769ac5fe22dff0a201ee2b6 Mon Sep 17 00:00:00 2001 From: Hubot Date: Wed, 29 Jun 2016 08:30:22 -0700 Subject: [PATCH 17/54] Sync changes from upstream repository --- content/webhooks/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/webhooks/index.md b/content/webhooks/index.md index a033ff3662..03fc42d1ca 100644 --- a/content/webhooks/index.md +++ b/content/webhooks/index.md @@ -50,7 +50,7 @@ Name | Description [`gollum`][event-types-gollum] | Any time a Wiki page is updated. [`issue_comment`][event-types-issue_comment] | {% if page.version == 'dotcom' or page.version > 2.6 %}Any time a [comment on an issue](/v3/issues/comments/) is created, edited, or deleted.{% else %}Any time an [issue is commented on](/v3/issues/comments).{% endif %} [`issues`][event-types-issues] | Any time an Issue is assigned, unassigned, labeled, unlabeled, opened, {% if page.version == 'dotcom' or page.version > 2.6 %}edited, {% endif %}closed, or reopened. -[`member`][event-types-member] | Any time a User is added as a collaborator to a non-Organization Repository. +[`member`][event-types-member] | Any time a User is added as a collaborator to a Repository. [`membership`][event-types-membership] | Any time a User is added or removed from a team. **Organization hooks only**. [`page_build`][event-types-page_build] | Any time a Pages site is built or results in a failed build. [`public`][event-types-public] | Any time a Repository changes from private to public. From cf9c9bd6317c9df9fe7cddde721ead2ca5e5bc54 Mon Sep 17 00:00:00 2001 From: Hubot Date: Thu, 30 Jun 2016 07:12:40 -0700 Subject: [PATCH 18/54] Sync changes from upstream repository --- content/v3/repos/commits.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/content/v3/repos/commits.md b/content/v3/repos/commits.md index 9c8e6e9a12..20c2ee69c3 100644 --- a/content/v3/repos/commits.md +++ b/content/v3/repos/commits.md @@ -25,9 +25,7 @@ Name | Type | Description ### Response -<%= - headers 200, :pagination => { :next => 'https://api.github.com/resource?page=2' } -%> +<%= headers 200, :pagination => default_pagination_rels %> <%= json(:commit) { |h| [h] } %> ## Get a single commit From 91cd7d654d462daa340dfd9741d02673fc8952da Mon Sep 17 00:00:00 2001 From: Hubot Date: Thu, 30 Jun 2016 12:34:16 -0700 Subject: [PATCH 19/54] Sync changes from upstream repository --- lib/responses/license.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/responses/license.rb b/lib/responses/license.rb index c06ea97b5d..46d97c4176 100644 --- a/lib/responses/license.rb +++ b/lib/responses/license.rb @@ -26,12 +26,11 @@ module Responses "html_url"=>"http://choosealicense.com/licenses/mit/", "featured"=>true, "description"=>"A permissive license that is short and to the point. It lets people do anything with your code with proper attribution and without warranty.", - "category"=>"MIT", "implementation"=> "Create a text file (typically named LICENSE or LICENSE.txt) in the root of your source code and copy the text of the license into the file. Replace [year] with the current year and [fullname] with the name (or names) of the copyright holders.", - "required"=>["include-copyright"], - "permitted"=>["commercial-use", "modifications", "distribution", "sublicense", "private-use"], - "forbidden"=>["no-liability"], + "permissions"=>["commercial-use", "modifications", "distribution", "sublicense", "private-use"], + "conditions"=>["include-copyright"], + "limitations"=>["no-liability"], "body"=> "\n\nThe MIT License (MIT)\n\nCopyright (c) [year] [fullname]\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n" } From dd38b89f7638fda685c6f7dfc8813147f158a884 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Thu, 30 Jun 2016 18:23:43 -0700 Subject: [PATCH 20/54] Use a more descriptive type for oauth.allow_signup If it's true or false, it's a boolean. --- content/v3/oauth.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/v3/oauth.md b/content/v3/oauth.md index 435cd815f8..1555d954d7 100644 --- a/content/v3/oauth.md +++ b/content/v3/oauth.md @@ -37,7 +37,7 @@ Name | Type | Description `redirect_uri`|`string` | The URL in your application where users will be sent after authorization. See details below about [redirect urls](#redirect-urls). `scope`|`string` | A space delimited list of [scopes](#scopes). If not provided, `scope` defaults to an empty list for users that have not authorized any scopes for the application. For users who have authorized scopes for the application, the user won't be shown the OAuth authorization page with the list of scopes. Instead, this step of the flow will automatically complete with the set of scopes the user has authorized for the application. For example, if a user has already performed the web flow twice and has authorized one token with `user` scope and another token with `repo` scope, a third web flow that does not provide a `scope` will receive a token with `user` and `repo` scope. `state`|`string` | An unguessable random string. It is used to protect against cross-site request forgery attacks. -`allow_signup`|`string` | Whether or not unauthenticated users will be offered an option to sign up for GitHub during the OAuth flow. The default is `true`. Use `false` in the case that a policy prohibits signups. +`allow_signup`|`boolean` | Whether or not unauthenticated users will be offered an option to sign up for GitHub during the OAuth flow. The default is `true`. Use `false` in the case that a policy prohibits signups. ### 2. GitHub redirects back to your site From 5dd1422bb03af0b773ea28d973b39a11751646f6 Mon Sep 17 00:00:00 2001 From: Hubot Date: Wed, 6 Jul 2016 12:17:31 -0700 Subject: [PATCH 21/54] Sync changes from upstream repository --- .../2016-07-06-github-pages-preiew-api.md | 43 +++++++++++++++ content/v3/repos/pages.md | 52 ++++++++++++++++++- lib/responses/pages.rb | 5 ++ 3 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 content/changes/2016-07-06-github-pages-preiew-api.md diff --git a/content/changes/2016-07-06-github-pages-preiew-api.md b/content/changes/2016-07-06-github-pages-preiew-api.md new file mode 100644 index 0000000000..6bbff3007a --- /dev/null +++ b/content/changes/2016-07-06-github-pages-preiew-api.md @@ -0,0 +1,43 @@ +--- +title: Introducing the GitHub Pages preview API +author_name: benbalter +--- + +We're introducing additional preview functionality to the [GitHub Pages API](/v3/repos/pages/) to give developers better control over their GitHub Pages site. + +#### Requesting a page build + +You can now manually request a build of your GitHub Pages site without needing to push a new commit by making a `POST` request to the endpoint already available to see past builds. For example: + +``` command-line +curl "https://api.github.com/repositories/github/developer.github.com/pages/builds" \ + -X POST + -H 'Authorization: token TOKEN' \ + -H "Accept: application/vnd.github.mister-fantstic-preview" \ +``` + +#### Retrieving a site's URL + +With the introduction of [HTTPS support for GitHub Pages sites](https://github.com/blog/2186-https-for-github-pages), it's important to know not just a site's custom domain, if it has one, but also if it has HTTPS enforcement enabled. The GitHub Pages API will now return an additional `html_url` field, which will include the computed absolute URL to the site. + +The resulting URL can be `https://username.github.io` (or `http://username.github.io`) for user sites without a custom domain, `https://username.gituhb.io/project` for project sites, or `http://example.com` for sites with custom domains, saving third-party applications the trouble of having to construct complicated URL logic based on the username, owner, and CNAME, as was previously necessary. + +For example, to request the HTML URL: + +``` command-line +curl "https://api.github.com/repositories/github/developer.github.com/pages" \ + -H 'Authorization: token TOKEN' \ + -H "Accept: application/vnd.github.mister-fantstic-preview" \ +``` + +#### How can I try it? + +To access this functionality during the preview period, you’ll need to provide the following custom media type in the Accept header: + +``` +application/vnd.github.mister-fantastic-preview+json +``` + +During the preview period, we may change aspects of these API methods based on developer feedback. If we do, we will announce the changes here on the developer blog, but we will not provide any advance notice. + +For more information, take a look at [the docs here](/v3/repos/pages/), and if you have any questions, please [get in touch](https://github.com/contact?form%5Bsubject%5D=GitHub+Pages+API+Preview). diff --git a/content/v3/repos/pages.md b/content/v3/repos/pages.md index b088606a33..78f8c5ba94 100644 --- a/content/v3/repos/pages.md +++ b/content/v3/repos/pages.md @@ -6,13 +6,14 @@ title: Pages {:toc} -The Pages API retrieves information about your GitHub Pages configuration, and +The GitHub Pages API retrieves information about your GitHub Pages configuration, and the statuses of your builds. Information about the site and the builds can only be accessed by authenticated owners, even though the websites are public. In JSON responses, `status` can be one of: * `null`, which means the site has yet to be built +* `queued`, which means the build has been requested but not yet begun * `building`, which means the build is in progress * `built`, which means the site has been built * `errored`, which indicates an error occurred during the build @@ -21,11 +22,60 @@ In JSON responses, `status` can be one of: GET /repos/:owner/:repo/pages +{% if page.version == 'dotcom' or page.version > 2.7 %} + +{{#tip}} + + + + Additional functionality of the GitHub Pages API is currently available for developers to preview. + During the preview period, the API may change without advance notice. + + To access the additional functionality during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header: + + application/vnd.github.mister-fantastic-preview+json + + When the [preview flag](#preview-period) is passed, the response will contain an additional field, `html_url`, which will contain the absolute URL (with scheme) to the rendered site (e.g., `https://username.github.io`, or `http://example.com`). + +{{/tip}} + +{% endif %} + ### Response <%= headers 200 %> <%= json(:pages) %> +{% if page.version == 'dotcom' or page.version > 2.7 %} + +## Request a page build + + POST /repos/:owner/:repo/pages/builds + +{{#tip}} + + + + This endpoint is currently available for developers to preview. + During the preview period, the API may change without advance notice. + + To access this endpoint during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header: + + application/vnd.github.mister-fantastic-preview+json + +{{/tip}} + +You can request that your site be built from the latest revision on the default branch. This has the same effect as pushing a commit to your default branch, but does not require an additional commit. Manually triggering page builds can be helpful when diagnosing build warnings and failures. + +Build requests are limited to one concurrent build per repository and one concurrent build per requester. If you request a build while another is still in progress, the second request will be queued until the first completes. + +### Response + +<%= headers 200 %> +<%= json(:pages_request_build) %> + +{% endif %} + ## List Pages builds GET /repos/:owner/:repo/pages/builds diff --git a/lib/responses/pages.rb b/lib/responses/pages.rb index 3854061833..d3d61ae3ab 100644 --- a/lib/responses/pages.rb +++ b/lib/responses/pages.rb @@ -22,6 +22,11 @@ module Responses "created_at" => "2014-02-10T19:00:49Z", "updated_at" => "2014-02-10T19:00:51Z" } + + PAGES_REQUEST_BUILD ||= { + "url" => "https://api.github.com/repos/github/developer.github.com/pages/builds/latest", + "status" => "queued" + } end end end From 0e76bd218b856b1df93b2d5c1a0aa2c9125400e7 Mon Sep 17 00:00:00 2001 From: Hubot Date: Thu, 7 Jul 2016 04:20:12 -0700 Subject: [PATCH 22/54] Sync changes from upstream repository --- content/changes/2016-06-14-repository-invitations.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/changes/2016-06-14-repository-invitations.md b/content/changes/2016-06-14-repository-invitations.md index f02f5c1f11..00cddde89d 100644 --- a/content/changes/2016-06-14-repository-invitations.md +++ b/content/changes/2016-06-14-repository-invitations.md @@ -12,9 +12,9 @@ We have now have endpoints for managing repository invitations for both reposito For example: ``` command-line -curl "https://api.github.com/api/v3/repositories/1313/invitations" \ +curl "https://api.github.com/repos/github/hubot/invitations" \ -H 'Authorization: token TOKEN' \ - -H "Accept: application/vnd.github.swamp-thing-preview" \ + -H "Accept: application/vnd.github.swamp-thing-preview" ``` You can learn more about the new endpoints in the updated [Collaborators][collaborators] and new [Repository Invitations][repo-invitations] documentation. From b9b3f5a0f6436aa9199a735b5d47a1420bd4a5de Mon Sep 17 00:00:00 2001 From: Hubot Date: Thu, 7 Jul 2016 22:49:43 -0700 Subject: [PATCH 23/54] Sync changes from upstream repository --- content/changes/2016-07-06-github-pages-preiew-api.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/changes/2016-07-06-github-pages-preiew-api.md b/content/changes/2016-07-06-github-pages-preiew-api.md index 6bbff3007a..2c8374b29d 100644 --- a/content/changes/2016-07-06-github-pages-preiew-api.md +++ b/content/changes/2016-07-06-github-pages-preiew-api.md @@ -10,7 +10,7 @@ We're introducing additional preview functionality to the [GitHub Pages API](/v3 You can now manually request a build of your GitHub Pages site without needing to push a new commit by making a `POST` request to the endpoint already available to see past builds. For example: ``` command-line -curl "https://api.github.com/repositories/github/developer.github.com/pages/builds" \ +curl "https://api.github.com/repos/github/developer.github.com/pages/builds" \ -X POST -H 'Authorization: token TOKEN' \ -H "Accept: application/vnd.github.mister-fantstic-preview" \ @@ -25,7 +25,7 @@ The resulting URL can be `https://username.github.io` (or `http://username.githu For example, to request the HTML URL: ``` command-line -curl "https://api.github.com/repositories/github/developer.github.com/pages" \ +curl "https://api.github.com/repos/github/developer.github.com/pages" \ -H 'Authorization: token TOKEN' \ -H "Accept: application/vnd.github.mister-fantstic-preview" \ ``` From b30e47ca4d9d812394fc94bdfb24daf1192dd192 Mon Sep 17 00:00:00 2001 From: Hubot Date: Fri, 8 Jul 2016 03:30:15 -0700 Subject: [PATCH 24/54] Sync changes from upstream repository --- content/v3/orgs/members.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/content/v3/orgs/members.md b/content/v3/orgs/members.md index 3088bebe09..6f1b79abe4 100644 --- a/content/v3/orgs/members.md +++ b/content/v3/orgs/members.md @@ -144,7 +144,11 @@ The user can publicize their own membership. ## Get organization membership -{% if page.version == 'dotcom' or page.version >= 2.4 %} +{% if page.version == 'dotcom' or page.version >= 2.6 %} + +In order to get a user's membership with an organization, the authenticated user must be an organization member. + +{% elsif page.version >= 2.4 %} In order to get a user's membership with an organization, the authenticated user must be an organization owner. From 78f311a811ba0c6fcfd6a75a99a61c416dffc5ad Mon Sep 17 00:00:00 2001 From: Hubot Date: Fri, 8 Jul 2016 09:27:13 -0700 Subject: [PATCH 25/54] Sync changes from upstream repository --- content/v3/repos/releases.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/content/v3/repos/releases.md b/content/v3/repos/releases.md index 7d792e19cc..73a2e10891 100644 --- a/content/v3/repos/releases.md +++ b/content/v3/repos/releases.md @@ -196,10 +196,9 @@ This may leave an empty asset with a state of `"new"`. It can be safely deleted {{#tip}} -If you want to download the asset's binary content, pass a media type of -`"application/octet-stream"`. The API will either redirect the client to the -location, or stream it directly if possible. API clients should handle both a -`200` or `302` response. +To download the asset's binary content, set the `Accept` header of the request to [`application/octet-stream`](https://developer.github.com/v3/media/#media-types). +The API will either redirect the client to the location, or stream it directly if possible. +API clients should handle both a `200` or `302` response. {{/tip}} From 81f6cd66a6750afdc172a0d91b8538f13d8892d8 Mon Sep 17 00:00:00 2001 From: Hubot Date: Fri, 8 Jul 2016 10:14:16 -0700 Subject: [PATCH 26/54] Sync changes from upstream repository --- content/changes/2016-06-22-issue-locking-api-is-now-official.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/changes/2016-06-22-issue-locking-api-is-now-official.md b/content/changes/2016-06-22-issue-locking-api-is-now-official.md index 432a14a0a5..81fb174003 100644 --- a/content/changes/2016-06-22-issue-locking-api-is-now-official.md +++ b/content/changes/2016-06-22-issue-locking-api-is-now-official.md @@ -5,7 +5,7 @@ author_name: davidcelis We're making the [Issue locking and unlocking APIs][issue-locking-blog-post] part of the official GitHub API. -During the preview period you needed to provide the `application/vnd.github.the-key-preview+sha` preview media type in the `Accept` header to opt-in to the new endpoints. Now that the preview period has ended, you no longer need to specify this custom [media type][custom-media-types]. +During the preview period you needed to provide the `application/vnd.github.the-key-preview+json` preview media type in the `Accept` header to opt-in to the new endpoints. Now that the preview period has ended, you no longer need to specify this custom [media type][custom-media-types]. If you have any questions or feedback, please [get in touch with us][contact]! From 2f6db25b21b85a70b69b3e4c3ef8b2dd7bc2796f Mon Sep 17 00:00:00 2001 From: Hubot Date: Mon, 11 Jul 2016 18:33:26 -0700 Subject: [PATCH 27/54] Sync changes from upstream repository --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index b0842a92cb..49c438d8e5 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,18 @@ Nanoc has [some nice documentation](http://nanoc.ws/docs/tutorial/) to get you s [nanoc]: http://nanoc.ws/ +### Enterprise + +To generate the `/enterprise/` versions, use `script/enterprise-backport`: + +``` sh +$ script/enterprise-backport 2.6 +$ mv -f enterprise output +$ script/server +``` + +The above will need to be repeated anytime changes are made to `/enterprise` versioned documentation. + ## Styleguide Not sure how to structure the docs? Here's what the structure of the From b565e2f444c54c00f34e4f257daaf22f4e3a9e47 Mon Sep 17 00:00:00 2001 From: Hubot Date: Tue, 12 Jul 2016 14:22:12 -0700 Subject: [PATCH 28/54] Sync changes from upstream repository --- content/v3/misc.md | 4 ++++ content/v3/rate_limit.md | 4 ++++ content/v3/search.md | 4 ++++ layouts/sidebar.html | 2 ++ 4 files changed, 14 insertions(+) diff --git a/content/v3/misc.md b/content/v3/misc.md index 01a57d22a2..7fefcbb369 100644 --- a/content/v3/misc.md +++ b/content/v3/misc.md @@ -33,11 +33,15 @@ organization's [GitHub Enterprise](https://enterprise.github.com/) installation. {% endif %} +{% if page.version == 'dotcom' %} + ## [Rate Limit][] The [Rate Limit API][Rate Limit] lets you check your current rate limit status at any time. +{% endif %} + ## [Licenses][] The [Licenses API][Licenses] returns information about open source licenses or under what license, if any a given project is distributed. diff --git a/content/v3/rate_limit.md b/content/v3/rate_limit.md index b19c878ecb..cb27f21b3b 100644 --- a/content/v3/rate_limit.md +++ b/content/v3/rate_limit.md @@ -2,6 +2,8 @@ title: Rate Limit --- +{% if page.version == 'dotcom' %} + # Rate Limit The overview documentation describes the [rate limit rules](/v3/#rate-limiting). @@ -49,3 +51,5 @@ version of the API. If you're writing new API client code (or updating your existing code), you should use the `"core"` object instead of the `"rate"` object. The `"core"` object contains the same information that is present in the `"rate"` object. + +{% endif %} diff --git a/content/v3/search.md b/content/v3/search.md index 05ca2781c1..39df7d1f6e 100644 --- a/content/v3/search.md +++ b/content/v3/search.md @@ -25,6 +25,8 @@ is a computed value representing the relevance of an item relative to the other items in the result set. Multiple factors are combined to boost the most relevant item to the top of the result list. +{% if page.version == 'dotcom' %} + ### Rate limit The Search API has a custom rate limit. For requests using [Basic @@ -36,6 +38,8 @@ to make up to 10 requests per minute. See the [rate limit documentation](/v3/#rate-limiting) for details on determining your current rate limit status. +{% endif %} + ### Timeouts and incomplete results To keep the Search API fast for everyone, we limit how long any individual query diff --git a/layouts/sidebar.html b/layouts/sidebar.html index 31ce45610c..fe51837c49 100644 --- a/layouts/sidebar.html +++ b/layouts/sidebar.html @@ -69,7 +69,9 @@

      Licenses
    • Markdown
    • Meta
    • + <% if @item[:version] == 'dotcom' %>
    • Rate Limit
    • + <% end %>

  • From 3ca3f26538087e4a976e040f81dae6f88dc7992d Mon Sep 17 00:00:00 2001 From: Hubot Date: Tue, 12 Jul 2016 14:53:22 -0700 Subject: [PATCH 29/54] Sync changes from upstream repository --- ...nding-multiple-assignees-preview-period.md | 13 ++++ content/v3/issues.md | 76 +------------------ content/v3/issues/assignees.md | 29 ------- content/v3/versions.md | 5 ++ 4 files changed, 22 insertions(+), 101 deletions(-) create mode 100644 content/changes/2016-7-1-ending-multiple-assignees-preview-period.md diff --git a/content/changes/2016-7-1-ending-multiple-assignees-preview-period.md b/content/changes/2016-7-1-ending-multiple-assignees-preview-period.md new file mode 100644 index 0000000000..13f6fc318b --- /dev/null +++ b/content/changes/2016-7-1-ending-multiple-assignees-preview-period.md @@ -0,0 +1,13 @@ +--- +title: Multiple Assignees API is now official +author_name: nakajima +--- + +We're making [Multiple Assignees][blog-post] part of the official GitHub API. + +During the preview period you needed to provide the `application/vnd.github.cerberus-preview` preview media type in the `Accept` header to opt-in to the changes. Now that the preview period has ended, you no longer need to specify this custom media type. + +If you have any questions or feedback, please [get in touch with us][contact]! + +[blog-post]: /changes/2016-5-27-multiple-assignees/ +[contact]: https://github.com/contact?form[subject]=Multiple+Assignees+API diff --git a/content/v3/issues.md b/content/v3/issues.md index e2f9b9f5f4..59e7f99a29 100644 --- a/content/v3/issues.md +++ b/content/v3/issues.md @@ -159,33 +159,18 @@ Name | Type | Description -----|------|-------------- `title`|`string` | **Required**. The title of the issue. `body`|`string` | The contents of the issue. -`assignee`|`string` | Login for the user that this issue should be assigned to. _NOTE: Only users with push access can set the assignee for new issues. The assignee is silently dropped otherwise._ +`assignee`|`string` | Login for the user that this issue should be assigned to. _NOTE: Only users with push access can set the assignee for new issues. The assignee is silently dropped otherwise. **This field is [deprecated](https://developer.github.com/v3/versions/#v3-deprecations).**_ `milestone`|`integer` | The `number` of the milestone to associate this issue with. _NOTE: Only users with push access can set the milestone for new issues. The milestone is silently dropped otherwise._ `labels`|`array` of `strings` | Labels to associate with this issue. _NOTE: Only users with push access can set labels for new issues. Labels are silently dropped otherwise._ `assignees`|`array` of `strings` | Logins for Users to assign to this issue. _NOTE: Only users with push access can set assignees for new issues. Assignees are silently dropped otherwise._ -{{#tip}} - - - -The `assignees` parameter is currently available for developers to preview. -During the preview period, the API may change without advance notice. -Please see the [blog post](/changes/2016-5-27-multiple-assignees) for full details. - -To access the API during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header: - - application/vnd.github.cerberus-preview+json - -The `assignees` key will only be accepted in issue payloads if this header is passed. - -{{/tip}} - #### Example <%= json \ :title => "Found a bug", :body => "I'm having a problem with this.", :assignee => "octocat", + :assignees => [get_resource(:user)], :milestone => 1, :labels => %w(bug) %> @@ -195,25 +180,6 @@ The `assignees` key will only be accepted in issue payloads if this header is pa <%= headers 201, :Location => get_resource(:full_issue)['url'] %> <%= json :full_issue %> -{% if page.version == 'dotcom' %} -#### Multiple Assignees - -{{#tip}} - - - - An additional `assignees` object in the issue payload is currently available for developers to preview. During the preview period, the APIs may change without advance notice. - Please see the [blog post](/changes/2016-5-27-multiple-assignees) for full details. - - To access the API you must provide a custom [media type](/v3/media) in the `Accept` header: - - application/vnd.github.cerberus-preview - - The `assignees` key will be an Array of Users who are assigned to the issue. - -{{/tip}} -{% endif %} - ## Edit an issue Issue owners and users with push access can edit an issue. @@ -226,34 +192,19 @@ Name | Type | Description -----|------|-------------- `title`|`string` | The title of the issue. `body`|`string` | The contents of the issue. -`assignee`|`string` | Login for the user that this issue should be assigned to. +`assignee`|`string` | Login for the user that this issue should be assigned to. **This field is [deprecated](https://developer.github.com/v3/versions/#v3-deprecations).** `state`|`string` | State of the issue. Either `open` or `closed`. `milestone`|`integer` | The `number` of the milestone to associate this issue with or `null` to remove current. _NOTE: Only users with push access can set the milestone for issues. The milestone is silently dropped otherwise._ `labels`|`array` of `strings` | Labels to associate with this issue. Pass one or more Labels to _replace_ the set of Labels on this Issue. Send an empty array (`[]`) to clear all Labels from the Issue. _NOTE: Only users with push access can set labels for issues. Labels are silently dropped otherwise._ `assignees`|`array` of `strings` | Logins for Users to assign to this issue. Pass one or more user logins to _replace_ the set of assignees on this Issue. .Send an empty array (`[]`) to clear all assignees from the Issue. _NOTE: Only users with push access can set assignees for new issues. Assignees are silently dropped otherwise._ -{{#tip}} - - - -The `assignees` parameter is currently available for developers to preview. -During the preview period, the API may change without advance notice. -Please see the [blog post](/changes/2016-5-27-multiple-assignees) for full details. - -To access the API during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header: - - application/vnd.github.cerberus-preview+json - -The `assignees` key will only be present in issue payloads if this header is passed. - -{{/tip}} - #### Example <%= json \ :title => "Found a bug", :body => "I'm having a problem with this.", :assignee => "octocat", + :assignees => [get_resource(:user)], :milestone => 1, :state => "open", :labels => %w(bug) @@ -264,25 +215,6 @@ The `assignees` key will only be present in issue payloads if this header is pas <%= headers 200 %> <%= json :full_issue %> -{% if page.version == 'dotcom' %} -#### Multiple Assignees - -{{#tip}} - - - - An additional `assignees` object in the issue payload is currently available for developers to preview. During the preview period, the APIs may change without advance notice. - Please see the [blog post](/changes/2016-5-27-multiple-assignees) for full details. - - To access the API you must provide a custom [media type](/v3/media) in the `Accept` header: - - application/vnd.github.cerberus-preview - - The `assignees` key will be an Array of Users who are assigned to the issue. - -{{/tip}} -{% endif %} - {% if page.version == 'dotcom' or page.version >= 2.6 %} ## Lock an issue diff --git a/content/v3/issues/assignees.md b/content/v3/issues/assignees.md index 139a98f98c..4d0c1a59a0 100644 --- a/content/v3/issues/assignees.md +++ b/content/v3/issues/assignees.md @@ -38,21 +38,6 @@ Otherwise a `404` status code is returned. ## Add assignees to an Issue -{{#tip}} - - - -This endpoint is currently available for developers to preview. -During the preview period, the API may change without advance notice. -Please see the [blog post](/changes/2016-5-27-multiple-assignees) for full details. - -To access the API during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header: - - application/vnd.github.cerberus-preview+json - -{{/tip}} - - This call adds the users passed in the `assignees` key (as their logins) to the issue. POST /repos/:owner/:repo/issues/:number/assignees @@ -68,20 +53,6 @@ This call adds the users passed in the `assignees` key (as their logins) to the ## Remove assignees from an Issue -{{#tip}} - - - -This endpoint is currently available for developers to preview. -During the preview period, the API may change without advance notice. -Please see the [blog post](/changes/2016-5-27-multiple-assignees) for full details. - -To access the API during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header: - - application/vnd.github.cerberus-preview+json - -{{/tip}} - This call removes the users passed in the `assignees` key (as their logins) from the issue. DELETE /repos/:owner/:repo/issues/:number/assignees diff --git a/content/v3/versions.md b/content/v3/versions.md index e9112368d7..53c7cf6f33 100644 --- a/content/v3/versions.md +++ b/content/v3/versions.md @@ -145,6 +145,11 @@ The recommendations below will help you prepare your application for the next ma Recommendation: This attribute no longer dictates the permission a team has on its repositories; it only dictates the default permission that the [Add or update team repository](/v3/orgs/teams/#add-or-update-team-repository) API will use for requests where no `permission` attribute is specified. To change the permission level for every repository on a team, use the [List team repositories](/v3/orgs/teams/#list-team-repos) API to list all of the team's repositories, and then use the [Add or update team repository](/v3/orgs/teams/#add-or-update-team-repository) with a `permission` attribute to update each repository's permission separately. +1. Issue attribute: assignee + + Recommendation: Use the [`assignees`](https://developer.github.com/v3/issues/#create-an-issue) key instead, since issues can have more than one assignee. Alternatively, you can use the + [assignees](https://developer.github.com/v3/issues/assignees/) endpoints. + # beta (Deprecated) From 86a03bf66a38195703fabf3c9d7760ec49e25ece Mon Sep 17 00:00:00 2001 From: Hubot Date: Tue, 12 Jul 2016 23:09:21 -0700 Subject: [PATCH 30/54] Sync changes from upstream repository --- ....md => 2016-07-12-ending-multiple-assignees-preview-period.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename content/changes/{2016-7-1-ending-multiple-assignees-preview-period.md => 2016-07-12-ending-multiple-assignees-preview-period.md} (100%) diff --git a/content/changes/2016-7-1-ending-multiple-assignees-preview-period.md b/content/changes/2016-07-12-ending-multiple-assignees-preview-period.md similarity index 100% rename from content/changes/2016-7-1-ending-multiple-assignees-preview-period.md rename to content/changes/2016-07-12-ending-multiple-assignees-preview-period.md From 53a38f9dbd20a99c90ebac1b05d332c3b0168fa8 Mon Sep 17 00:00:00 2001 From: Hubot Date: Thu, 14 Jul 2016 09:22:46 -0700 Subject: [PATCH 31/54] Sync changes from upstream repository --- README.md | 8 +++----- content/v3.md | 14 ++++++++++++-- content/v3/search.md | 8 ++++---- lib/resources.rb | 6 ++++-- script/server | 10 +++++++++- 5 files changed, 32 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 49c438d8e5..7a1e3bfcc9 100644 --- a/README.md +++ b/README.md @@ -48,15 +48,13 @@ Nanoc has [some nice documentation](http://nanoc.ws/docs/tutorial/) to get you s ### Enterprise -To generate the `/enterprise/` versions, use `script/enterprise-backport`: +To generate the `/enterprise` versions, pass in the Enterprise version to `script/server`. For example: ``` sh -$ script/enterprise-backport 2.6 -$ mv -f enterprise output -$ script/server +$ script/server 2.6 ``` -The above will need to be repeated anytime changes are made to `/enterprise` versioned documentation. +Note that live reloading is not available for Enterprise documentation. ## Styleguide diff --git a/content/v3.md b/content/v3.md index d73a059c18..a387737d67 100644 --- a/content/v3.md +++ b/content/v3.md @@ -32,9 +32,11 @@ $ curl -i {{ site.data.variables.product.api_url_pre }}/users/octocat/orgs > Status: 200 OK > ETag: "a00049ba79152d03380c34652f2cb612" > X-GitHub-Media-Type: github.v3 +{% if page.version == 'dotcom' %} > X-RateLimit-Limit: 5000 > X-RateLimit-Remaining: 4987 > X-RateLimit-Reset: 1350085394 +{% endif %} > Content-Length: 5 > Cache-Control: max-age=0, private, must-revalidate > X-Content-Type-Options: nosniff @@ -504,9 +506,11 @@ $ curl -i {{ site.data.variables.product.api_url_pre }}/user > Last-Modified: Thu, 05 Jul 2012 15:31:30 GMT > Status: 200 OK > Vary: Accept, Authorization, Cookie +{% if page.version == 'dotcom' %} > X-RateLimit-Limit: 5000 > X-RateLimit-Remaining: 4996 > X-RateLimit-Reset: 1372700873 +{% endif %} $ curl -i {{ site.data.variables.product.api_url_pre }}/user -H 'If-None-Match: "644b5b0155e6404a9cc4bd9d8b1ae730"' > HTTP/1.1 304 Not Modified @@ -515,9 +519,11 @@ $ curl -i {{ site.data.variables.product.api_url_pre }}/user -H 'If-None-Match: > Last-Modified: Thu, 05 Jul 2012 15:31:30 GMT > Status: 304 Not Modified > Vary: Accept, Authorization, Cookie +{% if page.version == 'dotcom' %} > X-RateLimit-Limit: 5000 > X-RateLimit-Remaining: 4996 > X-RateLimit-Reset: 1372700873 +{% endif %} $ curl -i {{ site.data.variables.product.api_url_pre }}/user -H "If-Modified-Since: Thu, 05 Jul 2012 15:31:30 GMT" > HTTP/1.1 304 Not Modified @@ -525,9 +531,11 @@ $ curl -i {{ site.data.variables.product.api_url_pre }}/user -H "If-Modified-Sin > Last-Modified: Thu, 05 Jul 2012 15:31:30 GMT > Status: 304 Not Modified > Vary: Accept, Authorization, Cookie +{% if page.version == 'dotcom' %} > X-RateLimit-Limit: 5000 > X-RateLimit-Remaining: 4996 > X-RateLimit-Reset: 1372700873 +{% endif %} ``` ## Cross Origin Resource Sharing @@ -545,7 +553,7 @@ Here's a sample request sent from a browser hitting $ curl -i {{ site.data.variables.product.api_url_pre }} -H "Origin: http://example.com" HTTP/1.1 302 Found Access-Control-Allow-Origin: * -Access-Control-Expose-Headers: ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval +Access-Control-Expose-Headers: ETag, Link, X-GitHub-OTP, {% if page.version == 'dotcom' %}X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset,{% endif %} X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval Access-Control-Allow-Credentials: true ``` @@ -557,7 +565,7 @@ HTTP/1.1 204 No Content Access-Control-Allow-Origin: * Access-Control-Allow-Headers: Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-GitHub-OTP, X-Requested-With Access-Control-Allow-Methods: GET, POST, PATCH, PUT, DELETE -Access-Control-Expose-Headers: ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval +Access-Control-Expose-Headers: ETag, Link, X-GitHub-OTP, {% if page.version == 'dotcom' %}X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset,{% endif %} X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval Access-Control-Max-Age: 86400 Access-Control-Allow-Credentials: true ``` @@ -576,9 +584,11 @@ $ curl https://api.github.com?callback=foo > /**/foo({ > "meta": { > "status": 200, +{% if page.version == 'dotcom' %} > "X-RateLimit-Limit": "5000", > "X-RateLimit-Remaining": "4966", > "X-RateLimit-Reset": "1372700873", +{% endif %} > "Link": [ // pagination headers and other links > ["https://api.github.com?page=2", {"rel": "next"}] > ] diff --git a/content/v3/search.md b/content/v3/search.md index 39df7d1f6e..bfdefdd175 100644 --- a/content/v3/search.md +++ b/content/v3/search.md @@ -97,7 +97,7 @@ repositories where the primary language is Assembly. We're sorting by stars in descending order, so that the most popular repositories appear first in the search results. -<%= headers 200, {:pagination => default_pagination_rels, 'X-RateLimit-Limit' => 20, 'X-RateLimit-Remaining' => 19} %> +<%= headers 200, {:pagination => default_pagination_rels{% if page.version == 'dotcom' %}, 'X-RateLimit-Limit' => 20, 'X-RateLimit-Remaining' => 19{% endif %}} %> <%= json(:repo_search_v3_results) %> ### Highlighting Repository Search Results @@ -186,7 +186,7 @@ Here, we're searching for the keyword `addClass` within a file's contents. We're making sure that we're only looking in files where the language is JavaScript. And we're scoping the search to the `repo:jquery/jquery` repository. -<%= headers 200, {:pagination => default_pagination_rels, 'X-RateLimit-Limit' => 20, 'X-RateLimit-Remaining' => 19} %> +<%= headers 200, {:pagination => default_pagination_rels,{% if page.version == 'dotcom' %} 'X-RateLimit-Limit' => 20, 'X-RateLimit-Remaining' => 19{% endif %}} %> <%= json(:code_search_v3_results) %> ### Highlighting Code Search Results @@ -289,7 +289,7 @@ that's labeled as `bug`. The search runs across repositories whose primary language is Python. We’re sorting by creation date in ascending order, so that the oldest issues appear first in the search results. -<%= headers 200, {:pagination => default_pagination_rels, 'X-RateLimit-Limit' => 20, 'X-RateLimit-Remaining' => 19} %> +<%= headers 200, {:pagination => default_pagination_rels,{% if page.version == 'dotcom' %} 'X-RateLimit-Limit' => 20, 'X-RateLimit-Remaining' => 19{% endif %}} %> <%= json(:issue_search_v3_results) %> ### Highlighting Issue Search Results @@ -361,7 +361,7 @@ Imagine you're looking for a list of popular users. You might try out this query Here, we're looking at users with the name Tom. We're only interested in those with more than 42 repositories, and only if they have over 1,000 followers. -<%= headers 200, {:pagination => default_pagination_rels, 'X-RateLimit-Limit' => 20, 'X-RateLimit-Remaining' => 19} %> +<%= headers 200, {:pagination => default_pagination_rels,{% if page.version == 'dotcom' %} 'X-RateLimit-Limit' => 20, 'X-RateLimit-Remaining' => 19{% endif %}} %> <%= json(:user_search_v3_results) %> ### Highlighting User Search Results diff --git a/lib/resources.rb b/lib/resources.rb index caa1276fee..8d3078aaec 100644 --- a/lib/resources.rb +++ b/lib/resources.rb @@ -67,8 +67,10 @@ def headers(status, head = {}) end end - lines << "X-RateLimit-Limit: 5000" unless head.has_key?('X-RateLimit-Limit') - lines << "X-RateLimit-Remaining: 4999" unless head.has_key?('X-RateLimit-Remaining') + unless @config[:version] != 'dotcom' + lines << "X-RateLimit-Limit: 5000" unless head.has_key?('X-RateLimit-Limit') + lines << "X-RateLimit-Remaining: 4999" unless head.has_key?('X-RateLimit-Remaining') + end %(``` headers\n#{lines.join("\n")}\n```\n) end diff --git a/script/server b/script/server index 33707763fe..d0365c2e66 100755 --- a/script/server +++ b/script/server @@ -3,4 +3,12 @@ ulimit -n 2048 script/bootstrap -DEV_MODE=true npm run gulp + +if [ -z "$1" ] + then + DEV_MODE=true npm run gulp + else + script/enterprise-backport $1 + mv -f enterprise output + npm run gulp server +fi From 9dd526708d48ea0f6d158339e11e359f985a67ba Mon Sep 17 00:00:00 2001 From: Hubot Date: Tue, 19 Jul 2016 01:59:34 -0700 Subject: [PATCH 32/54] Sync changes from upstream repository --- content/changes/2016-07-06-github-pages-preiew-api.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/changes/2016-07-06-github-pages-preiew-api.md b/content/changes/2016-07-06-github-pages-preiew-api.md index 2c8374b29d..ab14cbee46 100644 --- a/content/changes/2016-07-06-github-pages-preiew-api.md +++ b/content/changes/2016-07-06-github-pages-preiew-api.md @@ -13,7 +13,7 @@ You can now manually request a build of your GitHub Pages site without needing t curl "https://api.github.com/repos/github/developer.github.com/pages/builds" \ -X POST -H 'Authorization: token TOKEN' \ - -H "Accept: application/vnd.github.mister-fantstic-preview" \ + -H "Accept: application/vnd.github.mister-fantastic-preview" \ ``` #### Retrieving a site's URL @@ -27,7 +27,7 @@ For example, to request the HTML URL: ``` command-line curl "https://api.github.com/repos/github/developer.github.com/pages" \ -H 'Authorization: token TOKEN' \ - -H "Accept: application/vnd.github.mister-fantstic-preview" \ + -H "Accept: application/vnd.github.mister-fantastic-preview" \ ``` #### How can I try it? From 09675d035af2ec51ba44cf3be981f8eb40cdfbd9 Mon Sep 17 00:00:00 2001 From: Chao Date: Thu, 21 Jul 2016 15:16:36 -0400 Subject: [PATCH 33/54] fix date format. fix date format. --- lib/responses/admin.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/responses/admin.rb b/lib/responses/admin.rb index 6a8235cac3..340e6984f4 100644 --- a/lib/responses/admin.rb +++ b/lib/responses/admin.rb @@ -67,7 +67,7 @@ module Responses "seats_available" => 84, "kind" => "standard", "days_until_expiration" => 365, - "expire_at" => "2016/02/06 12:41:52 -0600" + "expire_at" => "2016-02-06T12:41:52-06:00" } INDEXING_SUCCESS ||= { From 95b05a946e09a259f59d6153c41d0cf4204d3a4c Mon Sep 17 00:00:00 2001 From: Hubot Date: Sun, 24 Jul 2016 04:39:07 -0700 Subject: [PATCH 34/54] Sync changes from upstream repository --- content/v3/gists.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/v3/gists.md b/content/v3/gists.md index 1038a72acb..0f73102306 100644 --- a/content/v3/gists.md +++ b/content/v3/gists.md @@ -48,7 +48,7 @@ Name | Type | Description List all public gists sorted by most recently updated to least recently updated. -Note: With pagination, you can fetch up to 200 [pages](/v3/#pagination). +Note: With [pagination](/v3/#pagination), you can fetch up to 3000 gists. For example, you can fetch 100 pages with 30 gists per page or 30 pages with 100 gists per page. GET /gists/public From 22879a2512dca092867bdccc88a2af36d3e572db Mon Sep 17 00:00:00 2001 From: Hubot Date: Fri, 29 Jul 2016 13:29:08 -0700 Subject: [PATCH 35/54] Sync changes from upstream repository --- .../v3/enterprise/pre_receive_environments.md | 193 ++++++++++++++++++ content/v3/enterprise/pre_receive_hooks.md | 110 ++++++++++ content/v3/orgs/pre_receive_hooks.md | 83 ++++++++ content/v3/repos/pre_receive_hooks.md | 88 ++++++++ layouts/sidebar.html | 10 + lib/responses/pre_receive.rb | 136 ++++++++++++ 6 files changed, 620 insertions(+) create mode 100644 content/v3/enterprise/pre_receive_environments.md create mode 100644 content/v3/enterprise/pre_receive_hooks.md create mode 100644 content/v3/orgs/pre_receive_hooks.md create mode 100644 content/v3/repos/pre_receive_hooks.md create mode 100644 lib/responses/pre_receive.rb diff --git a/content/v3/enterprise/pre_receive_environments.md b/content/v3/enterprise/pre_receive_environments.md new file mode 100644 index 0000000000..ac12fe2409 --- /dev/null +++ b/content/v3/enterprise/pre_receive_environments.md @@ -0,0 +1,193 @@ +--- +title: Pre-receive Environments +--- + +# Pre-receive Environments + +{{#tip}} + + + + APIs for managing pre-receive hooks are currently available for developers to preview. + During the preview period, the APIs may change without advance notice. + + To access the API you must provide a custom [media type](/v3/media) in the `Accept` header: + + application/vnd.github.eye-scream-preview + +{{/tip}} + +{:toc} + +The Pre-receive Environments API allows you to create, list, update and delete environments for pre-receive hooks. *It is only available to [authenticated](/v3/#authentication) site administrators.* Normal users will receive a `404` response if they try to access it. + +Prefix all the endpoints for this API with the following URL: + +``` command-line +http(s)://hostname/api/v3 +``` + +## Object attributes + +### Pre-receive Environment + +| Name | Type | Description | +|-----------------------|-----------|----------------------------------------------------------------------------| +| `name` | `string` | The name of the environment as displayed in the UI. | +| `image_url` | `string` | URL to the tarball that will be downloaded and extracted. | +| `default_environment` | `boolean` | Whether this is the default environment that ships with GitHub Enterprise. | +| `download` | `object` | This environment's download status. | +| `hooks_count` | `integer` | The number of pre-receive hooks that use this environment. | + +### Pre-receive Environment Download + +| Name | Type | Description | +|-----------------|----------|---------------------------------------------------------| +| `state` | `string` | The state of the most recent download. | +| `downloaded_at` | `string` | The time when the most recent download started. | +| `message` | `string` | On failure, this will have any error messages produced. | + +Possible values for `state` are `not_started`, `in_progress`, `success`, `failed`. + + +## Get a single pre-receive environment + + GET /admin/pre-receive-environments/:id + +<%= headers 200 %> +<%= json :pre_receive_environment %> + +## List pre-receive environments + + GET /admin/pre_receive_environments + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json :pre_receive_environments %> + +## Create a pre-receive environment + + POST /admin/pre_receive_environments + +### Parameters + +| Name | Type | Description | +|-------------|----------|-------------------------------------------------------------------------| +| `name` | `string` | **Required**. The new pre-receive environment's name. | +| `image_url` | `string` | **Required**. URL from which to download a tarball of this environment. | + +<%= json \ + :name => 'DevTools Hook Env', + :image_url => 'https://my_file_server/path/to/devtools_env.tar.gz' +%> + +### Response + +<%= headers 201 %> +<%= json :pre_receive_environment_create %> + +## Edit a pre-receive environment + + PATCH /admin/pre_receive_environments/:id + +### Parameters + +| Name | Type | Description | +|-------------|----------|-----------------------------------------------------------| +| `name` | `string` | This pre-receive environment's new name. | +| `image_url` | `string` | URL from which to download a tarball of this environment. | + +### Response +<%= headers 200 %> +<%= json :pre_receive_environment %> + +#### Client Errors + +If you attempt to modify the default environment, you will get a response like this: + +<%= headers 422 %> +<%= + json :message => "Validation Failed", + :errors => [{ + :resource => :PreReceiveEnvironment, + :code => :custom, + :message => 'Cannot modify or delete the default environment' + }] +%> + +## Delete a pre-receive environment + + DELETE /admin/pre_receive_environments/:id + +### Response + +<%= headers 204 %> + +#### Client Errors + +If you attempt to delete an environment that cannot be deleted, you will get a response like this: + +<%= headers 422 %> +<%= + json :message => "Validation Failed", + :errors => [{ + :resource => :PreReceiveEnvironment, + :code => :custom, + :message => 'Cannot modify or delete the default environment' + }] +%> + +The possible error messages are: + +- _Cannot modify or delete the default environment_ +- _Cannot delete environment that has hooks_ +- _Cannot delete environment when download is in progress_ + +## Get a pre-receive environment's download status + +In addition to seeing the download status at the `/admin/pre-receive-environments/:id`, there is also a separate endpoint for just the status. + + GET /admin/pre-receive-environments/:id/downloads/latest + +<%= headers 200 %> +<%= json :pre_receive_environment_download_2 %> + +### Object attributes + +| Name | Type | Description | +|-----------------|----------|---------------------------------------------------------| +| `state` | `string` | The state of the most recent download. | +| `downloaded_at` | `string` | The time when the most recent download started. | +| `message` | `string` | On failure, this will have any error messages produced. | + +Possible values for `state` are `not_started`, `in_progress`, `success`, `failed`. + +## Trigger a pre-receive environment download + +Triggers a new download of the environment tarball from the environment's `image_url`. When the download is finished, the newly downloaded tarball will overwrite the existing environment. + + POST /admin/pre_receive_environments/:id/downloads + +### Response + +<%= headers 202 %> +<%= json :pre_receive_environment_download %> + +#### Client Errors + +If a download cannot be triggered, you will get a reponse like this: + +<%= headers 422 %> +<%= + json :message => "Validation Failed", + :errors => [{ + :resource => :PreReceiveEnvironment, + :code => :custom, + :message => 'Can not start a new download when a download is in progress' + }] +%> + +The possible error messages are: + +- _Cannot modify or delete the default environment_ +- _Can not start a new download when a download is in progress_ + diff --git a/content/v3/enterprise/pre_receive_hooks.md b/content/v3/enterprise/pre_receive_hooks.md new file mode 100644 index 0000000000..876f242bbd --- /dev/null +++ b/content/v3/enterprise/pre_receive_hooks.md @@ -0,0 +1,110 @@ +--- +title: Pre-receive Hooks +--- + +# Pre-receive Hooks + +{{#tip}} + + + + APIs for managing pre-receive hooks are currently available for developers to preview. + During the preview period, the APIs may change without advance notice. + + To access the API you must provide a custom [media type](/v3/media) in the `Accept` header: + + application/vnd.github.eye-scream-preview + +{{/tip}} + +{:toc} + +The Pre-receive Hooks API allows you to create, list, update and delete +pre-receive hooks. *It is only available to +[authenticated](/v3/#authentication) site administrators.* Normal users +will receive a `404` response if they try to access it. + +Prefix all the endpoints for this API with the following URL: + +``` command-line +http(s)://hostname/api/v3 +``` + +## Object attributes + +### Pre-receive Hook + +| Name | Type | Description | +|----------------------------------|-----------|-----------------------------------------------------------------| +| `name` | `string` | The name of the hook. | +| `script` | `string` | The script that the hook runs. | +| `script_repository` | `object` | The GitHub repository where the script is kept. | +| `environment` | `object` | The pre-receive environment where the script is executed. | +| `enforcement` | `string` | The state of enforcement for this hook. | +| `allow_downstream_configuration` | `boolean` | Whether enforcement can be overridden at the org or repo level. | + +Possible values for *enforcement* are `enabled`, `disabled` and`testing`. `disabled` indicates the pre-receive hook will not run. `enabled` indicates it will run and reject +any pushes that result in a non-zero status. `testing` means the script will run but will not cause any pushes to be rejected. + +## Get a single pre-receive hook + + GET /admin/pre-receive-hooks/:id + +<%= headers 200 %> <%= json :pre_receive_hook %> + +## List pre-receive hooks + + GET /admin/pre-receive-hooks + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json :pre_receive_hooks %> + +## Create a pre-receive hook + + POST /admin/pre-receive-hooks + +### Parameters + +| Name | Type | Description | +|----------------------------------|-----------|----------------------------------------------------------------------------------| +| `name` | `string` | **Required** The name of the hook. | +| `script` | `string` | **Required** The script that the hook runs. | +| `script_repository` | `object` | **Required** The GitHub repository where the script is kept. | +| `environment` | `object` | **Required** The pre-receive environment where the script is executed. | +| `enforcement` | `string` | The state of enforcement for this hook. default: `disabled` | +| `allow_downstream_configuration` | `boolean` | Whether enforcement can be overridden at the org or repo level. default: `false` | + +<%= json \ + :name => "Check Commits", + :script => "scripts/commit_check.sh", + :enforcement => "disabled", + :allow_downstream_configuration => false, + :script_repository => { :full_name => "DevIT/hooks" }, + :environment => { :id => 2 } +%> + +### Response +<%= headers 201 %> +<%= json :pre_receive_hook %> + +## Edit a pre-receive hook + + PATCH /admin/pre_receive_hooks/:id + +<%= json \ + :name => "Check Commits", + :environment => { :id => 1 }, + :allow_downstream_configuration => true +%> + +### Response +<%= headers 200 %> +<%= json :pre_receive_hook_update %> + +## Delete a pre-receive hook + + DELETE /admin/pre_receive_hooks/:id + +### Response + +<%= headers 204 %> diff --git a/content/v3/orgs/pre_receive_hooks.md b/content/v3/orgs/pre_receive_hooks.md new file mode 100644 index 0000000000..7d3afc0bd4 --- /dev/null +++ b/content/v3/orgs/pre_receive_hooks.md @@ -0,0 +1,83 @@ +--- +title: Organization Pre-receive Hooks +--- + +# Organization Pre-receive Hooks (Enterprise) + +{{#tip}} + + + + APIs for managing pre-receive hooks are currently available for developers to preview. + During the preview period, the APIs may change without advance notice. + + To access the API you must provide a custom [media type](/v3/media) in the `Accept` header: + + application/vnd.github.eye-scream-preview + +{{/tip}} + +{:toc} + +The Organization Pre-receive Hooks API allows you to view and modify +enforcement of the pre-receive hooks that are available to an organization. + +Prefix all the endpoints for this API with the following URL: + +``` command-line +http(s)://hostname/api/v3 +``` + +## Object attributes + +| Name | Type | Description | +|----------------------------------|-----------|-----------------------------------------------------------| +| `name` | `string` | The name of the hook. | +| `enforcement` | `string` | The state of enforcement for the hook on this repository. | +| `allow_downstream_configuration` | `boolean` | Whether repositories can override enforcement. | +| `configuration_url` | `string` | URL for the endpoint where enforcement is set. | + +Possible values for *enforcement* are `enabled`, `disabled` and`testing`. `disabled` indicates the pre-receive hook will not run. `enabled` indicates it will run and reject +any pushes that result in a non-zero status. `testing` means the script will run but will not cause any pushes to be rejected. + +`configuration_url` may be a link to this endpoint or this hook's global +configuration. Only site admins are able to access the global configuration. + +## List pre-receive hooks + +List all pre-receive hooks that are enabled or testing for this +organization as well as any disabled hooks that can be configured at the +organization level. Globally disabled pre-receive hooks that do not allow +downstream configuration are not listed. + + GET /orgs/:org/pre-receive-hooks + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json :pre_receive_hooks_org %> + +## Get a single pre-receive hook + + GET /orgs/:org:pre-receive-hooks/:id + +<%= headers 200 %> <%= json :pre_receive_hook_org %> + +## Update pre-receive hook enforcement + +For pre-receive hooks which are allowed to be configured at the org level, you can set +`enforcement` and `allow_downstream_configuration` + + PATCH /orgs/:org/pre-receive-hooks/:id + +<%= json :enforcement => "enabled", :allow_downstream_configuration => false %> + +### Response + +<%= headers 200 %><%= json :pre_receive_hook_org_update %> + +## Remove enforcment overrides for a pre-receive hook + +Removes any overrides for this hook at the org level for this org. + + DELETE /orgs/:org/pre-receive-hooks/:id + +<%= headers 200 %> <%= json :pre_receive_hook_org %> diff --git a/content/v3/repos/pre_receive_hooks.md b/content/v3/repos/pre_receive_hooks.md new file mode 100644 index 0000000000..2eef1d9459 --- /dev/null +++ b/content/v3/repos/pre_receive_hooks.md @@ -0,0 +1,88 @@ +--- +title: Repository Pre-receive Hooks +--- + +# Repository Pre-receive Hooks (Enterprise) + +{{#tip}} + + + + APIs for managing pre-receive hooks are currently available for developers to preview. + During the preview period, the APIs may change without advance notice. + + To access the API you must provide a custom [media type](/v3/media) in the `Accept` header: + + application/vnd.github.eye-scream-preview + +{{/tip}} + + +{:toc} + +The Repository Pre-receive Hooks API allows you to view and modify +enforcement of the pre-receive hooks that are available to a repository. + +Prefix all the endpoints for this API with the following URL: + +``` command-line +http(s)://hostname/api/v3 +``` + +## Object attributes + +| Name | Type | Description | +|---------------------|----------|-----------------------------------------------------------| +| `name` | `string` | The name of the hook. | +| `enforcement` | `string` | The state of enforcement for the hook on this repository. | +| `configuration_url` | `string` | URL for the endpoint where enforcement is set. | + +Possible values for *enforcement* are `enabled`, `disabled` and`testing`. `disabled` indicates the pre-receive hook will not run. `enabled` indicates it will run and reject +any pushes that result in a non-zero status. `testing` means the script will run but will not cause any pushes to be rejected. + +`configuration_url` may be a link to this repository, it's organization +owner or global configuration. Authorization to access the endpoint at +`configuration_url` is determined at the owner or site admin level. + +## List pre-receive hooks + +List all pre-receive hooks that are enabled or testing for this +repository as well as any disabled hooks that are allowed to be enabled +at the repository level. Pre-receive hooks that are disabled at a higher +level and are not configurable will not be listed. + + GET /repos/:owner/:repo/pre-receive-hooks + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json :pre_receive_hooks_repo %> + +## Get a single pre-receive hook + + GET /repos/:owner/:repo/pre-receive-hooks/:id + +<%= headers 200 %> <%= json :pre_receive_hook_repo %> + +## Update pre-receive hook enforcement + +For pre-receive hooks which are allowed to be configured at the repo level, you can set `enforcement` + + PATCH /repos/:owner/:repo/pre-receive-hooks/:id + +<%= json :enforcement => "enabled" %> + +### Response + +<%= headers 200 %><%= json :pre_receive_hook_repo_update %> + +## Remove enforcement overrides for a pre-receive hook + +Deletes any overridden enforcement on this repository for the specified +hook. + + DELETE /repos/:owner/:repo/pre-receive-hooks/:id + +### Response + +Responds with effective values inherited from owner and/or global level. + +<%= headers 200 %> <%= json :pre_receive_hook_repo %> diff --git a/layouts/sidebar.html b/layouts/sidebar.html index fe51837c49..b36458f202 100644 --- a/layouts/sidebar.html +++ b/layouts/sidebar.html @@ -80,6 +80,9 @@

    Members

  • Teams
  • Webhooks
  • + <% if @item[:version].is_a?(Numeric) && @item[:version] >= 2.7 %> +
  • Pre-receive Hooks (Enterprise)
  • + <% end %>
  • @@ -116,6 +119,9 @@

    Statistics

  • Statuses
  • Webhooks
  • + <% if @item[:version].is_a?(Numeric) && @item[:version] >= 2.7 %> +
  • Pre-receive Hooks (Enterprise)
  • + <% end %>
  • @@ -147,6 +153,10 @@

    LDAP

  • License
  • Management Console
  • + <% if @item[:version].is_a?(Numeric) && @item[:version] >= 2.7 %> +
  • Pre-receive Environments
  • +
  • Pre-receive Hooks
  • + <% end %>
  • Search Indexing
  • <% if !@item[:version].nil? && (@item[:version] == 'dotcom' || @item[:version] >= 2.3) %>
  • Organization Administration
  • diff --git a/lib/responses/pre_receive.rb b/lib/responses/pre_receive.rb new file mode 100644 index 0000000000..6ccf0a4ab9 --- /dev/null +++ b/lib/responses/pre_receive.rb @@ -0,0 +1,136 @@ +module GitHub + module Resources + module Responses + URL_OPTIONS = { + :base_api_url => "https://github.example.com/api/v3", + :base_url => "https://github.example.com" + } + + def self.options_to_output(options, keys_to_use) + keys_to_use.map { |k| k.to_sym }.each_with_object(Hash.new) { |k, output| output[k] = options[k] } + end + + def self.pre_receive_environment_download(options = {}) + options = URL_OPTIONS.merge( + :id => 3, + :downloaded_at => '2016-05-26T07:42:53-05:00', + :state => 'success', + :message => nil + ).merge options + options[:url] = "#{options[:base_api_url]}/admin/pre-receive-environments/#{options[:id]}/downloads/latest" + options_to_output options, %w(url state downloaded_at message) + end + + def self.pre_receive_environment(options = {}) + options = URL_OPTIONS.merge( + :id => 1, + :name => 'Default', + :image_url => 'githubenterprise://internal', + :created_at => '2016-05-20T11:35:45-05:00', + :hooks_count => 1, + :download_options => {}, + :default_environment => true + ).merge options + options.update( + :url => "#{options[:base_api_url]}/admin/pre-receive-environments/#{options[:id]}", + :html_url => "#{options[:base_url]}/admin/pre_receive_environments/#{options[:id]}", + :download => pre_receive_environment_download(options.merge options[:download_options]) + ) + options_to_output options, %w(id name image_url url html_url default_environment created_at hooks_count download) + end + + def self.pre_receive_script_repository(options = {}) + options = URL_OPTIONS.merge( + :id => 595, + :full_name => "ExampleOrg/hooks", + ).merge options + options[:url] ||= "#{options[:base_api_url]}/repos/#{options[:full_name]}" + options[:html_url] ||= "#{options[:base_url]}/#{options[:script_repository][:full_name]}" + options_to_output options, %w(id full_name url html_url) + end + + def self.pre_receive_hook(options = {}) + options = URL_OPTIONS.merge( + :id => 1, + :name => 'Check Commits', + :script => 'scripts/commmit_check.sh', + :script_repository => { + :id => 595, + :full_name => "DevIT/hooks" + }, + :environment => PRE_RECEIVE_ENVIRONMENT, + :enforcement => "disabled", + :allow_downstream_configuration => false + ).merge options + options[:script_repository][:url] ||= + "#{options[:base_api_url]}/repos/#{options[:script_repository][:full_name]}" + options[:script_repository][:html_url] ||= + "#{options[:base_url]}/#{options[:script_repository][:full_name]}" + options_to_output(options, %w(id name enforcement script script_repository environment allow_downstream_configuration)) + end + + def self.pre_receive_hook_repo(options = {}) + options = URL_OPTIONS.merge( + :id => 42, + :name => "Check Commits", + :enforcement => "disabled", + :configuration_url => "/orgs/octocat/pre-receive-hooks/42" + ).merge options + options[:configuration_url] = "#{options[:base_api_url]}#{options[:configuration_url]}" + options_to_output(options, %w(id name enforcement configuration_url)) + end + + def self.pre_receive_hook_org(options = {}) + options = URL_OPTIONS.merge( + :id => 42, + :name => "Check Commits", + :enforcement => "disabled", + :configuration_url => "/admin/pre-receive-hooks/42", + :allow_downstream_configuration => true + ).merge options + options[:configuration_url] = "#{options[:base_api_url]}#{options[:configuration_url]}" + options_to_output(options, %w(id name enforcement configuration_url allow_downstream_configuration)) + end + + PRE_RECEIVE_ENVIRONMENT ||= pre_receive_environment ({ + :id => 2, + :name => "DevTools Hook Env", + :image_url => "https://my_file_server/path/to/devtools_env.tar.gz", + :default_environment => false + }) + + PRE_RECEIVE_ENVIRONMENT_CREATE ||= PRE_RECEIVE_ENVIRONMENT.merge ({ + "download": pre_receive_environment_download(:id => 2, :state => 'not_started', :downloaded_at => nil) + }) + + PRE_RECEIVE_ENVIRONMENTS ||= [ + pre_receive_environment(:download_options => {:state => 'not_started'}, :hooks_count => 14), + PRE_RECEIVE_ENVIRONMENT + ] + + PRE_RECEIVE_ENVIRONMENT_DOWNLOAD ||= + pre_receive_environment_download :state => 'not_started', + :downloaded_at => nil + + PRE_RECEIVE_ENVIRONMENT_DOWNLOAD_2 ||= pre_receive_environment_download + + PRE_RECEIVE_HOOK ||= pre_receive_hook + PRE_RECEIVE_HOOKS ||= [pre_receive_hook] + PRE_RECEIVE_HOOK_UPDATE ||= pre_receive_hook :allow_downstream_configuration => true, :environment => pre_receive_environment + + PRE_RECEIVE_HOOK_REPO ||= pre_receive_hook_repo + + PRE_RECEIVE_HOOKS_REPO ||= [pre_receive_hook_repo] + + PRE_RECEIVE_HOOK_REPO_UPDATE ||= pre_receive_hook_repo :enforcement => "enabled", + :configuration_url => "/repos/octocat/hello-world/pre-receive-hooks/42" + + PRE_RECEIVE_HOOK_ORG ||= pre_receive_hook_org + PRE_RECEIVE_HOOKS_ORG ||= [pre_receive_hook_org] + PRE_RECEIVE_HOOK_ORG_UPDATE ||= pre_receive_hook_org :enforcement => "enabled", + :configuration_url => "/orgs/octocat/pre-receive-hooks/42", + :allow_downstream_configuration => false + + end + end +end From 00da7b85ebeb4313551b7affa0e1f51b80f47a38 Mon Sep 17 00:00:00 2001 From: Hubot Date: Mon, 1 Aug 2016 12:58:31 -0700 Subject: [PATCH 36/54] Sync changes from upstream repository --- .../v3/enterprise/pre_receive_environments.md | 193 ------------------ content/v3/enterprise/pre_receive_hooks.md | 110 ---------- content/v3/orgs/pre_receive_hooks.md | 83 -------- content/v3/repos/pre_receive_hooks.md | 88 -------- layouts/sidebar.html | 10 - lib/responses/pre_receive.rb | 136 ------------ 6 files changed, 620 deletions(-) delete mode 100644 content/v3/enterprise/pre_receive_environments.md delete mode 100644 content/v3/enterprise/pre_receive_hooks.md delete mode 100644 content/v3/orgs/pre_receive_hooks.md delete mode 100644 content/v3/repos/pre_receive_hooks.md delete mode 100644 lib/responses/pre_receive.rb diff --git a/content/v3/enterprise/pre_receive_environments.md b/content/v3/enterprise/pre_receive_environments.md deleted file mode 100644 index ac12fe2409..0000000000 --- a/content/v3/enterprise/pre_receive_environments.md +++ /dev/null @@ -1,193 +0,0 @@ ---- -title: Pre-receive Environments ---- - -# Pre-receive Environments - -{{#tip}} - - - - APIs for managing pre-receive hooks are currently available for developers to preview. - During the preview period, the APIs may change without advance notice. - - To access the API you must provide a custom [media type](/v3/media) in the `Accept` header: - - application/vnd.github.eye-scream-preview - -{{/tip}} - -{:toc} - -The Pre-receive Environments API allows you to create, list, update and delete environments for pre-receive hooks. *It is only available to [authenticated](/v3/#authentication) site administrators.* Normal users will receive a `404` response if they try to access it. - -Prefix all the endpoints for this API with the following URL: - -``` command-line -http(s)://hostname/api/v3 -``` - -## Object attributes - -### Pre-receive Environment - -| Name | Type | Description | -|-----------------------|-----------|----------------------------------------------------------------------------| -| `name` | `string` | The name of the environment as displayed in the UI. | -| `image_url` | `string` | URL to the tarball that will be downloaded and extracted. | -| `default_environment` | `boolean` | Whether this is the default environment that ships with GitHub Enterprise. | -| `download` | `object` | This environment's download status. | -| `hooks_count` | `integer` | The number of pre-receive hooks that use this environment. | - -### Pre-receive Environment Download - -| Name | Type | Description | -|-----------------|----------|---------------------------------------------------------| -| `state` | `string` | The state of the most recent download. | -| `downloaded_at` | `string` | The time when the most recent download started. | -| `message` | `string` | On failure, this will have any error messages produced. | - -Possible values for `state` are `not_started`, `in_progress`, `success`, `failed`. - - -## Get a single pre-receive environment - - GET /admin/pre-receive-environments/:id - -<%= headers 200 %> -<%= json :pre_receive_environment %> - -## List pre-receive environments - - GET /admin/pre_receive_environments - -<%= headers 200, :pagination => default_pagination_rels %> -<%= json :pre_receive_environments %> - -## Create a pre-receive environment - - POST /admin/pre_receive_environments - -### Parameters - -| Name | Type | Description | -|-------------|----------|-------------------------------------------------------------------------| -| `name` | `string` | **Required**. The new pre-receive environment's name. | -| `image_url` | `string` | **Required**. URL from which to download a tarball of this environment. | - -<%= json \ - :name => 'DevTools Hook Env', - :image_url => 'https://my_file_server/path/to/devtools_env.tar.gz' -%> - -### Response - -<%= headers 201 %> -<%= json :pre_receive_environment_create %> - -## Edit a pre-receive environment - - PATCH /admin/pre_receive_environments/:id - -### Parameters - -| Name | Type | Description | -|-------------|----------|-----------------------------------------------------------| -| `name` | `string` | This pre-receive environment's new name. | -| `image_url` | `string` | URL from which to download a tarball of this environment. | - -### Response -<%= headers 200 %> -<%= json :pre_receive_environment %> - -#### Client Errors - -If you attempt to modify the default environment, you will get a response like this: - -<%= headers 422 %> -<%= - json :message => "Validation Failed", - :errors => [{ - :resource => :PreReceiveEnvironment, - :code => :custom, - :message => 'Cannot modify or delete the default environment' - }] -%> - -## Delete a pre-receive environment - - DELETE /admin/pre_receive_environments/:id - -### Response - -<%= headers 204 %> - -#### Client Errors - -If you attempt to delete an environment that cannot be deleted, you will get a response like this: - -<%= headers 422 %> -<%= - json :message => "Validation Failed", - :errors => [{ - :resource => :PreReceiveEnvironment, - :code => :custom, - :message => 'Cannot modify or delete the default environment' - }] -%> - -The possible error messages are: - -- _Cannot modify or delete the default environment_ -- _Cannot delete environment that has hooks_ -- _Cannot delete environment when download is in progress_ - -## Get a pre-receive environment's download status - -In addition to seeing the download status at the `/admin/pre-receive-environments/:id`, there is also a separate endpoint for just the status. - - GET /admin/pre-receive-environments/:id/downloads/latest - -<%= headers 200 %> -<%= json :pre_receive_environment_download_2 %> - -### Object attributes - -| Name | Type | Description | -|-----------------|----------|---------------------------------------------------------| -| `state` | `string` | The state of the most recent download. | -| `downloaded_at` | `string` | The time when the most recent download started. | -| `message` | `string` | On failure, this will have any error messages produced. | - -Possible values for `state` are `not_started`, `in_progress`, `success`, `failed`. - -## Trigger a pre-receive environment download - -Triggers a new download of the environment tarball from the environment's `image_url`. When the download is finished, the newly downloaded tarball will overwrite the existing environment. - - POST /admin/pre_receive_environments/:id/downloads - -### Response - -<%= headers 202 %> -<%= json :pre_receive_environment_download %> - -#### Client Errors - -If a download cannot be triggered, you will get a reponse like this: - -<%= headers 422 %> -<%= - json :message => "Validation Failed", - :errors => [{ - :resource => :PreReceiveEnvironment, - :code => :custom, - :message => 'Can not start a new download when a download is in progress' - }] -%> - -The possible error messages are: - -- _Cannot modify or delete the default environment_ -- _Can not start a new download when a download is in progress_ - diff --git a/content/v3/enterprise/pre_receive_hooks.md b/content/v3/enterprise/pre_receive_hooks.md deleted file mode 100644 index 876f242bbd..0000000000 --- a/content/v3/enterprise/pre_receive_hooks.md +++ /dev/null @@ -1,110 +0,0 @@ ---- -title: Pre-receive Hooks ---- - -# Pre-receive Hooks - -{{#tip}} - - - - APIs for managing pre-receive hooks are currently available for developers to preview. - During the preview period, the APIs may change without advance notice. - - To access the API you must provide a custom [media type](/v3/media) in the `Accept` header: - - application/vnd.github.eye-scream-preview - -{{/tip}} - -{:toc} - -The Pre-receive Hooks API allows you to create, list, update and delete -pre-receive hooks. *It is only available to -[authenticated](/v3/#authentication) site administrators.* Normal users -will receive a `404` response if they try to access it. - -Prefix all the endpoints for this API with the following URL: - -``` command-line -http(s)://hostname/api/v3 -``` - -## Object attributes - -### Pre-receive Hook - -| Name | Type | Description | -|----------------------------------|-----------|-----------------------------------------------------------------| -| `name` | `string` | The name of the hook. | -| `script` | `string` | The script that the hook runs. | -| `script_repository` | `object` | The GitHub repository where the script is kept. | -| `environment` | `object` | The pre-receive environment where the script is executed. | -| `enforcement` | `string` | The state of enforcement for this hook. | -| `allow_downstream_configuration` | `boolean` | Whether enforcement can be overridden at the org or repo level. | - -Possible values for *enforcement* are `enabled`, `disabled` and`testing`. `disabled` indicates the pre-receive hook will not run. `enabled` indicates it will run and reject -any pushes that result in a non-zero status. `testing` means the script will run but will not cause any pushes to be rejected. - -## Get a single pre-receive hook - - GET /admin/pre-receive-hooks/:id - -<%= headers 200 %> <%= json :pre_receive_hook %> - -## List pre-receive hooks - - GET /admin/pre-receive-hooks - -<%= headers 200, :pagination => default_pagination_rels %> -<%= json :pre_receive_hooks %> - -## Create a pre-receive hook - - POST /admin/pre-receive-hooks - -### Parameters - -| Name | Type | Description | -|----------------------------------|-----------|----------------------------------------------------------------------------------| -| `name` | `string` | **Required** The name of the hook. | -| `script` | `string` | **Required** The script that the hook runs. | -| `script_repository` | `object` | **Required** The GitHub repository where the script is kept. | -| `environment` | `object` | **Required** The pre-receive environment where the script is executed. | -| `enforcement` | `string` | The state of enforcement for this hook. default: `disabled` | -| `allow_downstream_configuration` | `boolean` | Whether enforcement can be overridden at the org or repo level. default: `false` | - -<%= json \ - :name => "Check Commits", - :script => "scripts/commit_check.sh", - :enforcement => "disabled", - :allow_downstream_configuration => false, - :script_repository => { :full_name => "DevIT/hooks" }, - :environment => { :id => 2 } -%> - -### Response -<%= headers 201 %> -<%= json :pre_receive_hook %> - -## Edit a pre-receive hook - - PATCH /admin/pre_receive_hooks/:id - -<%= json \ - :name => "Check Commits", - :environment => { :id => 1 }, - :allow_downstream_configuration => true -%> - -### Response -<%= headers 200 %> -<%= json :pre_receive_hook_update %> - -## Delete a pre-receive hook - - DELETE /admin/pre_receive_hooks/:id - -### Response - -<%= headers 204 %> diff --git a/content/v3/orgs/pre_receive_hooks.md b/content/v3/orgs/pre_receive_hooks.md deleted file mode 100644 index 7d3afc0bd4..0000000000 --- a/content/v3/orgs/pre_receive_hooks.md +++ /dev/null @@ -1,83 +0,0 @@ ---- -title: Organization Pre-receive Hooks ---- - -# Organization Pre-receive Hooks (Enterprise) - -{{#tip}} - - - - APIs for managing pre-receive hooks are currently available for developers to preview. - During the preview period, the APIs may change without advance notice. - - To access the API you must provide a custom [media type](/v3/media) in the `Accept` header: - - application/vnd.github.eye-scream-preview - -{{/tip}} - -{:toc} - -The Organization Pre-receive Hooks API allows you to view and modify -enforcement of the pre-receive hooks that are available to an organization. - -Prefix all the endpoints for this API with the following URL: - -``` command-line -http(s)://hostname/api/v3 -``` - -## Object attributes - -| Name | Type | Description | -|----------------------------------|-----------|-----------------------------------------------------------| -| `name` | `string` | The name of the hook. | -| `enforcement` | `string` | The state of enforcement for the hook on this repository. | -| `allow_downstream_configuration` | `boolean` | Whether repositories can override enforcement. | -| `configuration_url` | `string` | URL for the endpoint where enforcement is set. | - -Possible values for *enforcement* are `enabled`, `disabled` and`testing`. `disabled` indicates the pre-receive hook will not run. `enabled` indicates it will run and reject -any pushes that result in a non-zero status. `testing` means the script will run but will not cause any pushes to be rejected. - -`configuration_url` may be a link to this endpoint or this hook's global -configuration. Only site admins are able to access the global configuration. - -## List pre-receive hooks - -List all pre-receive hooks that are enabled or testing for this -organization as well as any disabled hooks that can be configured at the -organization level. Globally disabled pre-receive hooks that do not allow -downstream configuration are not listed. - - GET /orgs/:org/pre-receive-hooks - -<%= headers 200, :pagination => default_pagination_rels %> -<%= json :pre_receive_hooks_org %> - -## Get a single pre-receive hook - - GET /orgs/:org:pre-receive-hooks/:id - -<%= headers 200 %> <%= json :pre_receive_hook_org %> - -## Update pre-receive hook enforcement - -For pre-receive hooks which are allowed to be configured at the org level, you can set -`enforcement` and `allow_downstream_configuration` - - PATCH /orgs/:org/pre-receive-hooks/:id - -<%= json :enforcement => "enabled", :allow_downstream_configuration => false %> - -### Response - -<%= headers 200 %><%= json :pre_receive_hook_org_update %> - -## Remove enforcment overrides for a pre-receive hook - -Removes any overrides for this hook at the org level for this org. - - DELETE /orgs/:org/pre-receive-hooks/:id - -<%= headers 200 %> <%= json :pre_receive_hook_org %> diff --git a/content/v3/repos/pre_receive_hooks.md b/content/v3/repos/pre_receive_hooks.md deleted file mode 100644 index 2eef1d9459..0000000000 --- a/content/v3/repos/pre_receive_hooks.md +++ /dev/null @@ -1,88 +0,0 @@ ---- -title: Repository Pre-receive Hooks ---- - -# Repository Pre-receive Hooks (Enterprise) - -{{#tip}} - - - - APIs for managing pre-receive hooks are currently available for developers to preview. - During the preview period, the APIs may change without advance notice. - - To access the API you must provide a custom [media type](/v3/media) in the `Accept` header: - - application/vnd.github.eye-scream-preview - -{{/tip}} - - -{:toc} - -The Repository Pre-receive Hooks API allows you to view and modify -enforcement of the pre-receive hooks that are available to a repository. - -Prefix all the endpoints for this API with the following URL: - -``` command-line -http(s)://hostname/api/v3 -``` - -## Object attributes - -| Name | Type | Description | -|---------------------|----------|-----------------------------------------------------------| -| `name` | `string` | The name of the hook. | -| `enforcement` | `string` | The state of enforcement for the hook on this repository. | -| `configuration_url` | `string` | URL for the endpoint where enforcement is set. | - -Possible values for *enforcement* are `enabled`, `disabled` and`testing`. `disabled` indicates the pre-receive hook will not run. `enabled` indicates it will run and reject -any pushes that result in a non-zero status. `testing` means the script will run but will not cause any pushes to be rejected. - -`configuration_url` may be a link to this repository, it's organization -owner or global configuration. Authorization to access the endpoint at -`configuration_url` is determined at the owner or site admin level. - -## List pre-receive hooks - -List all pre-receive hooks that are enabled or testing for this -repository as well as any disabled hooks that are allowed to be enabled -at the repository level. Pre-receive hooks that are disabled at a higher -level and are not configurable will not be listed. - - GET /repos/:owner/:repo/pre-receive-hooks - -<%= headers 200, :pagination => default_pagination_rels %> -<%= json :pre_receive_hooks_repo %> - -## Get a single pre-receive hook - - GET /repos/:owner/:repo/pre-receive-hooks/:id - -<%= headers 200 %> <%= json :pre_receive_hook_repo %> - -## Update pre-receive hook enforcement - -For pre-receive hooks which are allowed to be configured at the repo level, you can set `enforcement` - - PATCH /repos/:owner/:repo/pre-receive-hooks/:id - -<%= json :enforcement => "enabled" %> - -### Response - -<%= headers 200 %><%= json :pre_receive_hook_repo_update %> - -## Remove enforcement overrides for a pre-receive hook - -Deletes any overridden enforcement on this repository for the specified -hook. - - DELETE /repos/:owner/:repo/pre-receive-hooks/:id - -### Response - -Responds with effective values inherited from owner and/or global level. - -<%= headers 200 %> <%= json :pre_receive_hook_repo %> diff --git a/layouts/sidebar.html b/layouts/sidebar.html index b36458f202..fe51837c49 100644 --- a/layouts/sidebar.html +++ b/layouts/sidebar.html @@ -80,9 +80,6 @@

    Members
  • Teams
  • Webhooks
  • - <% if @item[:version].is_a?(Numeric) && @item[:version] >= 2.7 %> -
  • Pre-receive Hooks (Enterprise)
  • - <% end %>
  • @@ -119,9 +116,6 @@

    Statistics

  • Statuses
  • Webhooks
  • - <% if @item[:version].is_a?(Numeric) && @item[:version] >= 2.7 %> -
  • Pre-receive Hooks (Enterprise)
  • - <% end %>
  • @@ -153,10 +147,6 @@

    LDAP

  • License
  • Management Console
  • - <% if @item[:version].is_a?(Numeric) && @item[:version] >= 2.7 %> -
  • Pre-receive Environments
  • -
  • Pre-receive Hooks
  • - <% end %>
  • Search Indexing
  • <% if !@item[:version].nil? && (@item[:version] == 'dotcom' || @item[:version] >= 2.3) %>
  • Organization Administration
  • diff --git a/lib/responses/pre_receive.rb b/lib/responses/pre_receive.rb deleted file mode 100644 index 6ccf0a4ab9..0000000000 --- a/lib/responses/pre_receive.rb +++ /dev/null @@ -1,136 +0,0 @@ -module GitHub - module Resources - module Responses - URL_OPTIONS = { - :base_api_url => "https://github.example.com/api/v3", - :base_url => "https://github.example.com" - } - - def self.options_to_output(options, keys_to_use) - keys_to_use.map { |k| k.to_sym }.each_with_object(Hash.new) { |k, output| output[k] = options[k] } - end - - def self.pre_receive_environment_download(options = {}) - options = URL_OPTIONS.merge( - :id => 3, - :downloaded_at => '2016-05-26T07:42:53-05:00', - :state => 'success', - :message => nil - ).merge options - options[:url] = "#{options[:base_api_url]}/admin/pre-receive-environments/#{options[:id]}/downloads/latest" - options_to_output options, %w(url state downloaded_at message) - end - - def self.pre_receive_environment(options = {}) - options = URL_OPTIONS.merge( - :id => 1, - :name => 'Default', - :image_url => 'githubenterprise://internal', - :created_at => '2016-05-20T11:35:45-05:00', - :hooks_count => 1, - :download_options => {}, - :default_environment => true - ).merge options - options.update( - :url => "#{options[:base_api_url]}/admin/pre-receive-environments/#{options[:id]}", - :html_url => "#{options[:base_url]}/admin/pre_receive_environments/#{options[:id]}", - :download => pre_receive_environment_download(options.merge options[:download_options]) - ) - options_to_output options, %w(id name image_url url html_url default_environment created_at hooks_count download) - end - - def self.pre_receive_script_repository(options = {}) - options = URL_OPTIONS.merge( - :id => 595, - :full_name => "ExampleOrg/hooks", - ).merge options - options[:url] ||= "#{options[:base_api_url]}/repos/#{options[:full_name]}" - options[:html_url] ||= "#{options[:base_url]}/#{options[:script_repository][:full_name]}" - options_to_output options, %w(id full_name url html_url) - end - - def self.pre_receive_hook(options = {}) - options = URL_OPTIONS.merge( - :id => 1, - :name => 'Check Commits', - :script => 'scripts/commmit_check.sh', - :script_repository => { - :id => 595, - :full_name => "DevIT/hooks" - }, - :environment => PRE_RECEIVE_ENVIRONMENT, - :enforcement => "disabled", - :allow_downstream_configuration => false - ).merge options - options[:script_repository][:url] ||= - "#{options[:base_api_url]}/repos/#{options[:script_repository][:full_name]}" - options[:script_repository][:html_url] ||= - "#{options[:base_url]}/#{options[:script_repository][:full_name]}" - options_to_output(options, %w(id name enforcement script script_repository environment allow_downstream_configuration)) - end - - def self.pre_receive_hook_repo(options = {}) - options = URL_OPTIONS.merge( - :id => 42, - :name => "Check Commits", - :enforcement => "disabled", - :configuration_url => "/orgs/octocat/pre-receive-hooks/42" - ).merge options - options[:configuration_url] = "#{options[:base_api_url]}#{options[:configuration_url]}" - options_to_output(options, %w(id name enforcement configuration_url)) - end - - def self.pre_receive_hook_org(options = {}) - options = URL_OPTIONS.merge( - :id => 42, - :name => "Check Commits", - :enforcement => "disabled", - :configuration_url => "/admin/pre-receive-hooks/42", - :allow_downstream_configuration => true - ).merge options - options[:configuration_url] = "#{options[:base_api_url]}#{options[:configuration_url]}" - options_to_output(options, %w(id name enforcement configuration_url allow_downstream_configuration)) - end - - PRE_RECEIVE_ENVIRONMENT ||= pre_receive_environment ({ - :id => 2, - :name => "DevTools Hook Env", - :image_url => "https://my_file_server/path/to/devtools_env.tar.gz", - :default_environment => false - }) - - PRE_RECEIVE_ENVIRONMENT_CREATE ||= PRE_RECEIVE_ENVIRONMENT.merge ({ - "download": pre_receive_environment_download(:id => 2, :state => 'not_started', :downloaded_at => nil) - }) - - PRE_RECEIVE_ENVIRONMENTS ||= [ - pre_receive_environment(:download_options => {:state => 'not_started'}, :hooks_count => 14), - PRE_RECEIVE_ENVIRONMENT - ] - - PRE_RECEIVE_ENVIRONMENT_DOWNLOAD ||= - pre_receive_environment_download :state => 'not_started', - :downloaded_at => nil - - PRE_RECEIVE_ENVIRONMENT_DOWNLOAD_2 ||= pre_receive_environment_download - - PRE_RECEIVE_HOOK ||= pre_receive_hook - PRE_RECEIVE_HOOKS ||= [pre_receive_hook] - PRE_RECEIVE_HOOK_UPDATE ||= pre_receive_hook :allow_downstream_configuration => true, :environment => pre_receive_environment - - PRE_RECEIVE_HOOK_REPO ||= pre_receive_hook_repo - - PRE_RECEIVE_HOOKS_REPO ||= [pre_receive_hook_repo] - - PRE_RECEIVE_HOOK_REPO_UPDATE ||= pre_receive_hook_repo :enforcement => "enabled", - :configuration_url => "/repos/octocat/hello-world/pre-receive-hooks/42" - - PRE_RECEIVE_HOOK_ORG ||= pre_receive_hook_org - PRE_RECEIVE_HOOKS_ORG ||= [pre_receive_hook_org] - PRE_RECEIVE_HOOK_ORG_UPDATE ||= pre_receive_hook_org :enforcement => "enabled", - :configuration_url => "/orgs/octocat/pre-receive-hooks/42", - :allow_downstream_configuration => false - - end - end -end From c0f824227f093ff2436bd41f074e638a22614854 Mon Sep 17 00:00:00 2001 From: Hubot Date: Tue, 2 Aug 2016 13:17:09 -0700 Subject: [PATCH 37/54] Sync changes from upstream repository --- .gitignore | 2 ++ Rakefile | 7 +++++++ script/enterprise-backport | 2 +- tasks/utils.rake | 2 +- tasks/versioning.rake | 4 ++++ 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 482b02b2a9..cb3b5339eb 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,8 @@ !/assets/vendor/lunr.js/lunr.js !/assets/vendor/lunr.js/lunr.min.js +_site/ +enterprise/ output tmp .DS_Store diff --git a/Rakefile b/Rakefile index 066f1ab736..b733333cb9 100644 --- a/Rakefile +++ b/Rakefile @@ -20,6 +20,10 @@ task :build do end end +task :build_latest_ent do + puts sh "script/enterprise-backport #{config[:versions].first} --keep" +end + desc "Test the output" task :test => [:remove_tmp_dir, :remove_output_dir, :build] do Rake::Task['spec'].invoke @@ -80,6 +84,9 @@ end namespace :assets do task :precompile => [:build] do sh 'mv output _site/' + Rake::Task['build_latest_ent'].invoke + sh "mkdir -p _site/enterprise/#{config[:versions].first}" + sh "mv output/* _site/enterprise/#{config[:versions].first}" end end diff --git a/script/enterprise-backport b/script/enterprise-backport index 8e8857ce87..8fa7c93ac1 100755 --- a/script/enterprise-backport +++ b/script/enterprise-backport @@ -52,7 +52,7 @@ data_variables: Nanoc::Int::SiteLoader.new.new_with_config(versioned_config).compile puts `node_modules/gulp/bin/gulp.js assets` - fail unless $CHILD_STATUS.to_i == 0 + raise unless $CHILD_STATUS.to_i == 0 versioned_config end diff --git a/tasks/utils.rake b/tasks/utils.rake index de2bc3aa0b..715373183d 100644 --- a/tasks/utils.rake +++ b/tasks/utils.rake @@ -1,3 +1,4 @@ +require 'yaml' require 'json' require 'active_support/core_ext/hash' @@ -8,4 +9,3 @@ end def symbolize_hash(hash) hash.deep_symbolize_keys end - diff --git a/tasks/versioning.rake b/tasks/versioning.rake index ad161de5d7..20baf25473 100644 --- a/tasks/versioning.rake +++ b/tasks/versioning.rake @@ -131,3 +131,7 @@ def cleanup FileUtils.rm_rf "#{VERSIONED_ENT_PATH}/assets/vendor" FileUtils.rm_rf "#{VERSIONED_ENT_PATH}/assets/images" end + +def keep? + ARGV.include?('--keep') +end From c07350e4198e0da96e143e24bd13bfcdefd6a212 Mon Sep 17 00:00:00 2001 From: Hubot Date: Wed, 3 Aug 2016 10:13:50 -0700 Subject: [PATCH 38/54] Sync changes from upstream repository --- .../v3/enterprise/pre_receive_environments.md | 193 ++++++++++++++++++ content/v3/enterprise/pre_receive_hooks.md | 110 ++++++++++ content/v3/orgs/pre_receive_hooks.md | 83 ++++++++ content/v3/repos/pre_receive_hooks.md | 88 ++++++++ layouts/sidebar.html | 10 + lib/responses/pre_receive.rb | 136 ++++++++++++ nanoc.yaml | 3 +- 7 files changed, 622 insertions(+), 1 deletion(-) create mode 100644 content/v3/enterprise/pre_receive_environments.md create mode 100644 content/v3/enterprise/pre_receive_hooks.md create mode 100644 content/v3/orgs/pre_receive_hooks.md create mode 100644 content/v3/repos/pre_receive_hooks.md create mode 100644 lib/responses/pre_receive.rb diff --git a/content/v3/enterprise/pre_receive_environments.md b/content/v3/enterprise/pre_receive_environments.md new file mode 100644 index 0000000000..ac12fe2409 --- /dev/null +++ b/content/v3/enterprise/pre_receive_environments.md @@ -0,0 +1,193 @@ +--- +title: Pre-receive Environments +--- + +# Pre-receive Environments + +{{#tip}} + + + + APIs for managing pre-receive hooks are currently available for developers to preview. + During the preview period, the APIs may change without advance notice. + + To access the API you must provide a custom [media type](/v3/media) in the `Accept` header: + + application/vnd.github.eye-scream-preview + +{{/tip}} + +{:toc} + +The Pre-receive Environments API allows you to create, list, update and delete environments for pre-receive hooks. *It is only available to [authenticated](/v3/#authentication) site administrators.* Normal users will receive a `404` response if they try to access it. + +Prefix all the endpoints for this API with the following URL: + +``` command-line +http(s)://hostname/api/v3 +``` + +## Object attributes + +### Pre-receive Environment + +| Name | Type | Description | +|-----------------------|-----------|----------------------------------------------------------------------------| +| `name` | `string` | The name of the environment as displayed in the UI. | +| `image_url` | `string` | URL to the tarball that will be downloaded and extracted. | +| `default_environment` | `boolean` | Whether this is the default environment that ships with GitHub Enterprise. | +| `download` | `object` | This environment's download status. | +| `hooks_count` | `integer` | The number of pre-receive hooks that use this environment. | + +### Pre-receive Environment Download + +| Name | Type | Description | +|-----------------|----------|---------------------------------------------------------| +| `state` | `string` | The state of the most recent download. | +| `downloaded_at` | `string` | The time when the most recent download started. | +| `message` | `string` | On failure, this will have any error messages produced. | + +Possible values for `state` are `not_started`, `in_progress`, `success`, `failed`. + + +## Get a single pre-receive environment + + GET /admin/pre-receive-environments/:id + +<%= headers 200 %> +<%= json :pre_receive_environment %> + +## List pre-receive environments + + GET /admin/pre_receive_environments + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json :pre_receive_environments %> + +## Create a pre-receive environment + + POST /admin/pre_receive_environments + +### Parameters + +| Name | Type | Description | +|-------------|----------|-------------------------------------------------------------------------| +| `name` | `string` | **Required**. The new pre-receive environment's name. | +| `image_url` | `string` | **Required**. URL from which to download a tarball of this environment. | + +<%= json \ + :name => 'DevTools Hook Env', + :image_url => 'https://my_file_server/path/to/devtools_env.tar.gz' +%> + +### Response + +<%= headers 201 %> +<%= json :pre_receive_environment_create %> + +## Edit a pre-receive environment + + PATCH /admin/pre_receive_environments/:id + +### Parameters + +| Name | Type | Description | +|-------------|----------|-----------------------------------------------------------| +| `name` | `string` | This pre-receive environment's new name. | +| `image_url` | `string` | URL from which to download a tarball of this environment. | + +### Response +<%= headers 200 %> +<%= json :pre_receive_environment %> + +#### Client Errors + +If you attempt to modify the default environment, you will get a response like this: + +<%= headers 422 %> +<%= + json :message => "Validation Failed", + :errors => [{ + :resource => :PreReceiveEnvironment, + :code => :custom, + :message => 'Cannot modify or delete the default environment' + }] +%> + +## Delete a pre-receive environment + + DELETE /admin/pre_receive_environments/:id + +### Response + +<%= headers 204 %> + +#### Client Errors + +If you attempt to delete an environment that cannot be deleted, you will get a response like this: + +<%= headers 422 %> +<%= + json :message => "Validation Failed", + :errors => [{ + :resource => :PreReceiveEnvironment, + :code => :custom, + :message => 'Cannot modify or delete the default environment' + }] +%> + +The possible error messages are: + +- _Cannot modify or delete the default environment_ +- _Cannot delete environment that has hooks_ +- _Cannot delete environment when download is in progress_ + +## Get a pre-receive environment's download status + +In addition to seeing the download status at the `/admin/pre-receive-environments/:id`, there is also a separate endpoint for just the status. + + GET /admin/pre-receive-environments/:id/downloads/latest + +<%= headers 200 %> +<%= json :pre_receive_environment_download_2 %> + +### Object attributes + +| Name | Type | Description | +|-----------------|----------|---------------------------------------------------------| +| `state` | `string` | The state of the most recent download. | +| `downloaded_at` | `string` | The time when the most recent download started. | +| `message` | `string` | On failure, this will have any error messages produced. | + +Possible values for `state` are `not_started`, `in_progress`, `success`, `failed`. + +## Trigger a pre-receive environment download + +Triggers a new download of the environment tarball from the environment's `image_url`. When the download is finished, the newly downloaded tarball will overwrite the existing environment. + + POST /admin/pre_receive_environments/:id/downloads + +### Response + +<%= headers 202 %> +<%= json :pre_receive_environment_download %> + +#### Client Errors + +If a download cannot be triggered, you will get a reponse like this: + +<%= headers 422 %> +<%= + json :message => "Validation Failed", + :errors => [{ + :resource => :PreReceiveEnvironment, + :code => :custom, + :message => 'Can not start a new download when a download is in progress' + }] +%> + +The possible error messages are: + +- _Cannot modify or delete the default environment_ +- _Can not start a new download when a download is in progress_ + diff --git a/content/v3/enterprise/pre_receive_hooks.md b/content/v3/enterprise/pre_receive_hooks.md new file mode 100644 index 0000000000..876f242bbd --- /dev/null +++ b/content/v3/enterprise/pre_receive_hooks.md @@ -0,0 +1,110 @@ +--- +title: Pre-receive Hooks +--- + +# Pre-receive Hooks + +{{#tip}} + + + + APIs for managing pre-receive hooks are currently available for developers to preview. + During the preview period, the APIs may change without advance notice. + + To access the API you must provide a custom [media type](/v3/media) in the `Accept` header: + + application/vnd.github.eye-scream-preview + +{{/tip}} + +{:toc} + +The Pre-receive Hooks API allows you to create, list, update and delete +pre-receive hooks. *It is only available to +[authenticated](/v3/#authentication) site administrators.* Normal users +will receive a `404` response if they try to access it. + +Prefix all the endpoints for this API with the following URL: + +``` command-line +http(s)://hostname/api/v3 +``` + +## Object attributes + +### Pre-receive Hook + +| Name | Type | Description | +|----------------------------------|-----------|-----------------------------------------------------------------| +| `name` | `string` | The name of the hook. | +| `script` | `string` | The script that the hook runs. | +| `script_repository` | `object` | The GitHub repository where the script is kept. | +| `environment` | `object` | The pre-receive environment where the script is executed. | +| `enforcement` | `string` | The state of enforcement for this hook. | +| `allow_downstream_configuration` | `boolean` | Whether enforcement can be overridden at the org or repo level. | + +Possible values for *enforcement* are `enabled`, `disabled` and`testing`. `disabled` indicates the pre-receive hook will not run. `enabled` indicates it will run and reject +any pushes that result in a non-zero status. `testing` means the script will run but will not cause any pushes to be rejected. + +## Get a single pre-receive hook + + GET /admin/pre-receive-hooks/:id + +<%= headers 200 %> <%= json :pre_receive_hook %> + +## List pre-receive hooks + + GET /admin/pre-receive-hooks + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json :pre_receive_hooks %> + +## Create a pre-receive hook + + POST /admin/pre-receive-hooks + +### Parameters + +| Name | Type | Description | +|----------------------------------|-----------|----------------------------------------------------------------------------------| +| `name` | `string` | **Required** The name of the hook. | +| `script` | `string` | **Required** The script that the hook runs. | +| `script_repository` | `object` | **Required** The GitHub repository where the script is kept. | +| `environment` | `object` | **Required** The pre-receive environment where the script is executed. | +| `enforcement` | `string` | The state of enforcement for this hook. default: `disabled` | +| `allow_downstream_configuration` | `boolean` | Whether enforcement can be overridden at the org or repo level. default: `false` | + +<%= json \ + :name => "Check Commits", + :script => "scripts/commit_check.sh", + :enforcement => "disabled", + :allow_downstream_configuration => false, + :script_repository => { :full_name => "DevIT/hooks" }, + :environment => { :id => 2 } +%> + +### Response +<%= headers 201 %> +<%= json :pre_receive_hook %> + +## Edit a pre-receive hook + + PATCH /admin/pre_receive_hooks/:id + +<%= json \ + :name => "Check Commits", + :environment => { :id => 1 }, + :allow_downstream_configuration => true +%> + +### Response +<%= headers 200 %> +<%= json :pre_receive_hook_update %> + +## Delete a pre-receive hook + + DELETE /admin/pre_receive_hooks/:id + +### Response + +<%= headers 204 %> diff --git a/content/v3/orgs/pre_receive_hooks.md b/content/v3/orgs/pre_receive_hooks.md new file mode 100644 index 0000000000..7d3afc0bd4 --- /dev/null +++ b/content/v3/orgs/pre_receive_hooks.md @@ -0,0 +1,83 @@ +--- +title: Organization Pre-receive Hooks +--- + +# Organization Pre-receive Hooks (Enterprise) + +{{#tip}} + + + + APIs for managing pre-receive hooks are currently available for developers to preview. + During the preview period, the APIs may change without advance notice. + + To access the API you must provide a custom [media type](/v3/media) in the `Accept` header: + + application/vnd.github.eye-scream-preview + +{{/tip}} + +{:toc} + +The Organization Pre-receive Hooks API allows you to view and modify +enforcement of the pre-receive hooks that are available to an organization. + +Prefix all the endpoints for this API with the following URL: + +``` command-line +http(s)://hostname/api/v3 +``` + +## Object attributes + +| Name | Type | Description | +|----------------------------------|-----------|-----------------------------------------------------------| +| `name` | `string` | The name of the hook. | +| `enforcement` | `string` | The state of enforcement for the hook on this repository. | +| `allow_downstream_configuration` | `boolean` | Whether repositories can override enforcement. | +| `configuration_url` | `string` | URL for the endpoint where enforcement is set. | + +Possible values for *enforcement* are `enabled`, `disabled` and`testing`. `disabled` indicates the pre-receive hook will not run. `enabled` indicates it will run and reject +any pushes that result in a non-zero status. `testing` means the script will run but will not cause any pushes to be rejected. + +`configuration_url` may be a link to this endpoint or this hook's global +configuration. Only site admins are able to access the global configuration. + +## List pre-receive hooks + +List all pre-receive hooks that are enabled or testing for this +organization as well as any disabled hooks that can be configured at the +organization level. Globally disabled pre-receive hooks that do not allow +downstream configuration are not listed. + + GET /orgs/:org/pre-receive-hooks + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json :pre_receive_hooks_org %> + +## Get a single pre-receive hook + + GET /orgs/:org:pre-receive-hooks/:id + +<%= headers 200 %> <%= json :pre_receive_hook_org %> + +## Update pre-receive hook enforcement + +For pre-receive hooks which are allowed to be configured at the org level, you can set +`enforcement` and `allow_downstream_configuration` + + PATCH /orgs/:org/pre-receive-hooks/:id + +<%= json :enforcement => "enabled", :allow_downstream_configuration => false %> + +### Response + +<%= headers 200 %><%= json :pre_receive_hook_org_update %> + +## Remove enforcment overrides for a pre-receive hook + +Removes any overrides for this hook at the org level for this org. + + DELETE /orgs/:org/pre-receive-hooks/:id + +<%= headers 200 %> <%= json :pre_receive_hook_org %> diff --git a/content/v3/repos/pre_receive_hooks.md b/content/v3/repos/pre_receive_hooks.md new file mode 100644 index 0000000000..2eef1d9459 --- /dev/null +++ b/content/v3/repos/pre_receive_hooks.md @@ -0,0 +1,88 @@ +--- +title: Repository Pre-receive Hooks +--- + +# Repository Pre-receive Hooks (Enterprise) + +{{#tip}} + + + + APIs for managing pre-receive hooks are currently available for developers to preview. + During the preview period, the APIs may change without advance notice. + + To access the API you must provide a custom [media type](/v3/media) in the `Accept` header: + + application/vnd.github.eye-scream-preview + +{{/tip}} + + +{:toc} + +The Repository Pre-receive Hooks API allows you to view and modify +enforcement of the pre-receive hooks that are available to a repository. + +Prefix all the endpoints for this API with the following URL: + +``` command-line +http(s)://hostname/api/v3 +``` + +## Object attributes + +| Name | Type | Description | +|---------------------|----------|-----------------------------------------------------------| +| `name` | `string` | The name of the hook. | +| `enforcement` | `string` | The state of enforcement for the hook on this repository. | +| `configuration_url` | `string` | URL for the endpoint where enforcement is set. | + +Possible values for *enforcement* are `enabled`, `disabled` and`testing`. `disabled` indicates the pre-receive hook will not run. `enabled` indicates it will run and reject +any pushes that result in a non-zero status. `testing` means the script will run but will not cause any pushes to be rejected. + +`configuration_url` may be a link to this repository, it's organization +owner or global configuration. Authorization to access the endpoint at +`configuration_url` is determined at the owner or site admin level. + +## List pre-receive hooks + +List all pre-receive hooks that are enabled or testing for this +repository as well as any disabled hooks that are allowed to be enabled +at the repository level. Pre-receive hooks that are disabled at a higher +level and are not configurable will not be listed. + + GET /repos/:owner/:repo/pre-receive-hooks + +<%= headers 200, :pagination => default_pagination_rels %> +<%= json :pre_receive_hooks_repo %> + +## Get a single pre-receive hook + + GET /repos/:owner/:repo/pre-receive-hooks/:id + +<%= headers 200 %> <%= json :pre_receive_hook_repo %> + +## Update pre-receive hook enforcement + +For pre-receive hooks which are allowed to be configured at the repo level, you can set `enforcement` + + PATCH /repos/:owner/:repo/pre-receive-hooks/:id + +<%= json :enforcement => "enabled" %> + +### Response + +<%= headers 200 %><%= json :pre_receive_hook_repo_update %> + +## Remove enforcement overrides for a pre-receive hook + +Deletes any overridden enforcement on this repository for the specified +hook. + + DELETE /repos/:owner/:repo/pre-receive-hooks/:id + +### Response + +Responds with effective values inherited from owner and/or global level. + +<%= headers 200 %> <%= json :pre_receive_hook_repo %> diff --git a/layouts/sidebar.html b/layouts/sidebar.html index fe51837c49..35dd666473 100644 --- a/layouts/sidebar.html +++ b/layouts/sidebar.html @@ -80,6 +80,9 @@

    Members
  • Teams
  • Webhooks
  • + <% if @item[:version].is_a?(Numeric) && @item[:version] >= 2.7 %> +
  • Pre-receive Hooks (Enterprise)
  • + <% end %>
  • @@ -116,6 +119,9 @@

    Statistics

  • Statuses
  • Webhooks
  • + <% if @item[:version].is_a?(Numeric) && @item[:version] >= 2.7 %> +
  • Pre-receive Hooks (Enterprise)
  • + <% end %>
  • @@ -147,6 +153,10 @@

    LDAP

  • License
  • Management Console
  • + <% if !@item[:version].nil? && (@item[:version] == 'dotcom' || @item[:version] >= 2.7) %> +
  • Pre-receive Environments
  • +
  • Pre-receive Hooks
  • + <% end %>
  • Search Indexing
  • <% if !@item[:version].nil? && (@item[:version] == 'dotcom' || @item[:version] >= 2.3) %>
  • Organization Administration
  • diff --git a/lib/responses/pre_receive.rb b/lib/responses/pre_receive.rb new file mode 100644 index 0000000000..6ccf0a4ab9 --- /dev/null +++ b/lib/responses/pre_receive.rb @@ -0,0 +1,136 @@ +module GitHub + module Resources + module Responses + URL_OPTIONS = { + :base_api_url => "https://github.example.com/api/v3", + :base_url => "https://github.example.com" + } + + def self.options_to_output(options, keys_to_use) + keys_to_use.map { |k| k.to_sym }.each_with_object(Hash.new) { |k, output| output[k] = options[k] } + end + + def self.pre_receive_environment_download(options = {}) + options = URL_OPTIONS.merge( + :id => 3, + :downloaded_at => '2016-05-26T07:42:53-05:00', + :state => 'success', + :message => nil + ).merge options + options[:url] = "#{options[:base_api_url]}/admin/pre-receive-environments/#{options[:id]}/downloads/latest" + options_to_output options, %w(url state downloaded_at message) + end + + def self.pre_receive_environment(options = {}) + options = URL_OPTIONS.merge( + :id => 1, + :name => 'Default', + :image_url => 'githubenterprise://internal', + :created_at => '2016-05-20T11:35:45-05:00', + :hooks_count => 1, + :download_options => {}, + :default_environment => true + ).merge options + options.update( + :url => "#{options[:base_api_url]}/admin/pre-receive-environments/#{options[:id]}", + :html_url => "#{options[:base_url]}/admin/pre_receive_environments/#{options[:id]}", + :download => pre_receive_environment_download(options.merge options[:download_options]) + ) + options_to_output options, %w(id name image_url url html_url default_environment created_at hooks_count download) + end + + def self.pre_receive_script_repository(options = {}) + options = URL_OPTIONS.merge( + :id => 595, + :full_name => "ExampleOrg/hooks", + ).merge options + options[:url] ||= "#{options[:base_api_url]}/repos/#{options[:full_name]}" + options[:html_url] ||= "#{options[:base_url]}/#{options[:script_repository][:full_name]}" + options_to_output options, %w(id full_name url html_url) + end + + def self.pre_receive_hook(options = {}) + options = URL_OPTIONS.merge( + :id => 1, + :name => 'Check Commits', + :script => 'scripts/commmit_check.sh', + :script_repository => { + :id => 595, + :full_name => "DevIT/hooks" + }, + :environment => PRE_RECEIVE_ENVIRONMENT, + :enforcement => "disabled", + :allow_downstream_configuration => false + ).merge options + options[:script_repository][:url] ||= + "#{options[:base_api_url]}/repos/#{options[:script_repository][:full_name]}" + options[:script_repository][:html_url] ||= + "#{options[:base_url]}/#{options[:script_repository][:full_name]}" + options_to_output(options, %w(id name enforcement script script_repository environment allow_downstream_configuration)) + end + + def self.pre_receive_hook_repo(options = {}) + options = URL_OPTIONS.merge( + :id => 42, + :name => "Check Commits", + :enforcement => "disabled", + :configuration_url => "/orgs/octocat/pre-receive-hooks/42" + ).merge options + options[:configuration_url] = "#{options[:base_api_url]}#{options[:configuration_url]}" + options_to_output(options, %w(id name enforcement configuration_url)) + end + + def self.pre_receive_hook_org(options = {}) + options = URL_OPTIONS.merge( + :id => 42, + :name => "Check Commits", + :enforcement => "disabled", + :configuration_url => "/admin/pre-receive-hooks/42", + :allow_downstream_configuration => true + ).merge options + options[:configuration_url] = "#{options[:base_api_url]}#{options[:configuration_url]}" + options_to_output(options, %w(id name enforcement configuration_url allow_downstream_configuration)) + end + + PRE_RECEIVE_ENVIRONMENT ||= pre_receive_environment ({ + :id => 2, + :name => "DevTools Hook Env", + :image_url => "https://my_file_server/path/to/devtools_env.tar.gz", + :default_environment => false + }) + + PRE_RECEIVE_ENVIRONMENT_CREATE ||= PRE_RECEIVE_ENVIRONMENT.merge ({ + "download": pre_receive_environment_download(:id => 2, :state => 'not_started', :downloaded_at => nil) + }) + + PRE_RECEIVE_ENVIRONMENTS ||= [ + pre_receive_environment(:download_options => {:state => 'not_started'}, :hooks_count => 14), + PRE_RECEIVE_ENVIRONMENT + ] + + PRE_RECEIVE_ENVIRONMENT_DOWNLOAD ||= + pre_receive_environment_download :state => 'not_started', + :downloaded_at => nil + + PRE_RECEIVE_ENVIRONMENT_DOWNLOAD_2 ||= pre_receive_environment_download + + PRE_RECEIVE_HOOK ||= pre_receive_hook + PRE_RECEIVE_HOOKS ||= [pre_receive_hook] + PRE_RECEIVE_HOOK_UPDATE ||= pre_receive_hook :allow_downstream_configuration => true, :environment => pre_receive_environment + + PRE_RECEIVE_HOOK_REPO ||= pre_receive_hook_repo + + PRE_RECEIVE_HOOKS_REPO ||= [pre_receive_hook_repo] + + PRE_RECEIVE_HOOK_REPO_UPDATE ||= pre_receive_hook_repo :enforcement => "enabled", + :configuration_url => "/repos/octocat/hello-world/pre-receive-hooks/42" + + PRE_RECEIVE_HOOK_ORG ||= pre_receive_hook_org + PRE_RECEIVE_HOOKS_ORG ||= [pre_receive_hook_org] + PRE_RECEIVE_HOOK_ORG_UPDATE ||= pre_receive_hook_org :enforcement => "enabled", + :configuration_url => "/orgs/octocat/pre-receive-hooks/42", + :allow_downstream_configuration => false + + end + end +end diff --git a/nanoc.yaml b/nanoc.yaml index 5dc691517e..1f22d618df 100644 --- a/nanoc.yaml +++ b/nanoc.yaml @@ -12,7 +12,8 @@ pipeline_config: asset_root: https://a248.e.akamai.net/assets.github.com/images/icons versions: - - &latest_enterprise_version 2.6 + - &latest_enterprise_version 2.7 + - 2.6 - 2.5 - 2.4 - 2.3 From 26e8ca5c900f4e244ef7514e0f1f365822060628 Mon Sep 17 00:00:00 2001 From: Hubot Date: Wed, 3 Aug 2016 10:59:40 -0700 Subject: [PATCH 39/54] Sync changes from upstream repository --- repository-sync | 1 + 1 file changed, 1 insertion(+) create mode 100644 repository-sync diff --git a/repository-sync b/repository-sync new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/repository-sync @@ -0,0 +1 @@ +1 From 30ec6f73d02dfcfe55a7fdc41f0d1c4225be5323 Mon Sep 17 00:00:00 2001 From: Dirkjan Bussink Date: Wed, 3 Aug 2016 20:02:50 +0200 Subject: [PATCH 40/54] Revert "Sync changes from upstream repository" This reverts commit c0f824227f093ff2436bd41f074e638a22614854. --- .gitignore | 2 -- Rakefile | 7 ------- script/enterprise-backport | 2 +- tasks/utils.rake | 2 +- tasks/versioning.rake | 4 ---- 5 files changed, 2 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index cb3b5339eb..482b02b2a9 100644 --- a/.gitignore +++ b/.gitignore @@ -12,8 +12,6 @@ !/assets/vendor/lunr.js/lunr.js !/assets/vendor/lunr.js/lunr.min.js -_site/ -enterprise/ output tmp .DS_Store diff --git a/Rakefile b/Rakefile index b733333cb9..066f1ab736 100644 --- a/Rakefile +++ b/Rakefile @@ -20,10 +20,6 @@ task :build do end end -task :build_latest_ent do - puts sh "script/enterprise-backport #{config[:versions].first} --keep" -end - desc "Test the output" task :test => [:remove_tmp_dir, :remove_output_dir, :build] do Rake::Task['spec'].invoke @@ -84,9 +80,6 @@ end namespace :assets do task :precompile => [:build] do sh 'mv output _site/' - Rake::Task['build_latest_ent'].invoke - sh "mkdir -p _site/enterprise/#{config[:versions].first}" - sh "mv output/* _site/enterprise/#{config[:versions].first}" end end diff --git a/script/enterprise-backport b/script/enterprise-backport index 8fa7c93ac1..8e8857ce87 100755 --- a/script/enterprise-backport +++ b/script/enterprise-backport @@ -52,7 +52,7 @@ data_variables: Nanoc::Int::SiteLoader.new.new_with_config(versioned_config).compile puts `node_modules/gulp/bin/gulp.js assets` - raise unless $CHILD_STATUS.to_i == 0 + fail unless $CHILD_STATUS.to_i == 0 versioned_config end diff --git a/tasks/utils.rake b/tasks/utils.rake index 715373183d..de2bc3aa0b 100644 --- a/tasks/utils.rake +++ b/tasks/utils.rake @@ -1,4 +1,3 @@ -require 'yaml' require 'json' require 'active_support/core_ext/hash' @@ -9,3 +8,4 @@ end def symbolize_hash(hash) hash.deep_symbolize_keys end + diff --git a/tasks/versioning.rake b/tasks/versioning.rake index 20baf25473..ad161de5d7 100644 --- a/tasks/versioning.rake +++ b/tasks/versioning.rake @@ -131,7 +131,3 @@ def cleanup FileUtils.rm_rf "#{VERSIONED_ENT_PATH}/assets/vendor" FileUtils.rm_rf "#{VERSIONED_ENT_PATH}/assets/images" end - -def keep? - ARGV.include?('--keep') -end From daa9070241b47862deaf7109da5d7c1e3808d792 Mon Sep 17 00:00:00 2001 From: Hubot Date: Wed, 3 Aug 2016 11:37:23 -0700 Subject: [PATCH 41/54] Sync changes from upstream repository --- content/v3/reactions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/v3/reactions.md b/content/v3/reactions.md index a492093f4c..d8effc8a38 100644 --- a/content/v3/reactions.md +++ b/content/v3/reactions.md @@ -2,7 +2,7 @@ title: Reactions --- -{% if page.version == 'dotcom' %} +{% if page.version == 'dotcom' or page.version >= 2.7 %} # Reactions @@ -24,7 +24,7 @@ title: Reactions ## Reaction types - + When creating a reaction, the allowed values for the `content` parameter are as follows (with the corresponding emoji for reference): content | emoji From 685b58c584cd2bfe48de0add28924ee6adacdd22 Mon Sep 17 00:00:00 2001 From: Hubot Date: Thu, 4 Aug 2016 09:47:49 -0700 Subject: [PATCH 42/54] Sync changes from upstream repository --- content/v3/repos/collaborators.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/v3/repos/collaborators.md b/content/v3/repos/collaborators.md index 5bd3ad05b4..5e22e210d7 100644 --- a/content/v3/repos/collaborators.md +++ b/content/v3/repos/collaborators.md @@ -19,11 +19,11 @@ collaborators list. ### Response +{% if page.version != 'dotcom' and page.version > 2.3 and page.version < 2.6 %} + <%= headers 200, :pagination => default_pagination_rels %> <%= json(:user) { |h| [h] } %> -{% if page.version != 'dotcom' and page.version > 2.3 and page.version < 2.6 %} - ### Alternative response with extra repository information {{#tip}} From 3643cbc394ce96be53382d27e7c134b814758b82 Mon Sep 17 00:00:00 2001 From: Hubot Date: Fri, 5 Aug 2016 09:44:59 -0700 Subject: [PATCH 43/54] Sync changes from upstream repository --- content/integrations-directory/getting-listed.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/content/integrations-directory/getting-listed.md b/content/integrations-directory/getting-listed.md index 907a9088c0..7a96f11057 100644 --- a/content/integrations-directory/getting-listed.md +++ b/content/integrations-directory/getting-listed.md @@ -37,11 +37,7 @@ marketing site. As your product changes, keep your Integration Directory listing ### Provide categories for your listing -Help GitHub users find your integration faster with the appropriate categories. Please send us your suggested categories for the listing. We reserve the right to remove categories from a listing, but we won't add any categories without your approval. Currently, the following categories are available: - -* Code -* Collaborate -* Ship +Help GitHub users find your integration faster with the appropriate categories. Please send us your suggested categories for the listing from those available in the [Integrations Directory](https://github.com/integrations). If you don't see a category that fits quite right, just let us know. We reserve the right to change categories associated with the listing. If we do so, we'll do our best to keep you informed. If your integration supports both GitHub.com and GitHub Enterprise, please let us know. From 420621464ee2a0b96a9c3b089cd085421e3ccab3 Mon Sep 17 00:00:00 2001 From: Hubot Date: Mon, 8 Aug 2016 03:11:46 -0700 Subject: [PATCH 44/54] Sync changes from upstream repository --- ...pages-preiew-api.md => 2016-07-06-github-pages-preview-api.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename content/changes/{2016-07-06-github-pages-preiew-api.md => 2016-07-06-github-pages-preview-api.md} (100%) diff --git a/content/changes/2016-07-06-github-pages-preiew-api.md b/content/changes/2016-07-06-github-pages-preview-api.md similarity index 100% rename from content/changes/2016-07-06-github-pages-preiew-api.md rename to content/changes/2016-07-06-github-pages-preview-api.md From 6d983225b476e7cbaf5152001bc89fc5261363a3 Mon Sep 17 00:00:00 2001 From: Hubot Date: Tue, 9 Aug 2016 11:45:20 -0700 Subject: [PATCH 45/54] Sync changes from upstream repository --- ...om-organization-api-responses-for-owner.md | 22 +++++++++++++++++++ content/v3/orgs.md | 6 +++++ 2 files changed, 28 insertions(+) create mode 100644 content/changes/2016-08-09-breaking-change-removed-sensitive-fields-from-organization-api-responses-for-owner.md diff --git a/content/changes/2016-08-09-breaking-change-removed-sensitive-fields-from-organization-api-responses-for-owner.md b/content/changes/2016-08-09-breaking-change-removed-sensitive-fields-from-organization-api-responses-for-owner.md new file mode 100644 index 0000000000..22f0e9cd3c --- /dev/null +++ b/content/changes/2016-08-09-breaking-change-removed-sensitive-fields-from-organization-api-responses-for-owner.md @@ -0,0 +1,22 @@ +--- +title: "Breaking change: Removed sensitive fields from Organization API responses for non-owners" +author_name: kdaigle +--- + +We're removing some values from [Organization API](https://developer.github.com/v3/orgs/) responses to help protect our +users' privacy. Previously, these fields were returned to all members of the organization. +As of today, you must be an Organization owner to +receive values for the following fields in Organization responses: + +* `private_gists` +* `disk_usage` +* `collaborators` +* `billing_email` + +If you're not an organization owner, the above keys will now return `null`. +We will continue to send these fields without their values to minimize the impact +of this change. + +If you have any questions or feedback, please [drop us a line][contact]. + +[contact]: https://github.com/contact?form[subject]=Removed+sensitive+fields+from+org+api diff --git a/content/v3/orgs.md b/content/v3/orgs.md index 3ba152583b..aa7419a031 100644 --- a/content/v3/orgs.md +++ b/content/v3/orgs.md @@ -61,6 +61,12 @@ This method only lists *public* memberships, regardless of authentication. If yo ## Get an organization +{% if page.version == 'dotcom' or page.version >= 2.8 %} +Note: To receive values for `private_gists`, `disk_usage`, `collaborators`, and +`billing_email` in the Organization response, the authenticated user must be an +organization owner and have authorized the `admin:org` scope. +{% endif %} + GET /orgs/:org ### Response From 084e21e2c4a5ed8cbc88f34f5b4f26b16dd4d5ea Mon Sep 17 00:00:00 2001 From: Hubot Date: Mon, 15 Aug 2016 00:43:54 -0700 Subject: [PATCH 46/54] Sync changes from upstream repository --- content/v3/repos/branches.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/v3/repos/branches.md b/content/v3/repos/branches.md index 1c11628394..e620efd95c 100644 --- a/content/v3/repos/branches.md +++ b/content/v3/repos/branches.md @@ -228,7 +228,7 @@ Protecting a branch requires admin access. ### Parameters -You can pass two objects: `required_status_checks` and `restrictions`. Both can have the value `null` for disabled. +You must pass two objects: `required_status_checks` and `restrictions`. Both can have the value `null` for disabled. The `required_status_checks` object must have the following keys: From e0389e571a7f18fdccdebdd06dc67245c8357a5e Mon Sep 17 00:00:00 2001 From: Hubot Date: Mon, 15 Aug 2016 06:46:21 -0700 Subject: [PATCH 47/54] Sync changes from upstream repository --- .../changes/2016-08-15-traffic-api-preview.md | 18 ++++ content/v3/repos/traffic.md | 79 ++++++++++++++++ layouts/sidebar.html | 3 + lib/responses/traffic.rb | 94 +++++++++++++++++++ 4 files changed, 194 insertions(+) create mode 100644 content/changes/2016-08-15-traffic-api-preview.md create mode 100644 content/v3/repos/traffic.md create mode 100644 lib/responses/traffic.rb diff --git a/content/changes/2016-08-15-traffic-api-preview.md b/content/changes/2016-08-15-traffic-api-preview.md new file mode 100644 index 0000000000..60b089e380 --- /dev/null +++ b/content/changes/2016-08-15-traffic-api-preview.md @@ -0,0 +1,18 @@ +--- +title: Preview the Repository Traffic API +author_name: shreyasjoshis +--- + + We've added an API for repository traffic, which will let you fetch details about traffic for repositories you have push access to. This data is already available in graphical form in the [Graphs section](https://help.github.com/articles/about-repository-graphs/#traffic) on GitHub.com. + +To access [the Traffic API][docs] during the preview period, you must provide a custom [media type][media-type] in the `Accept` header: + + application/vnd.github.spiderman-preview + +During the preview period, we may change aspects of these API methods based on developer feedback. If we do, we will announce the changes here on the developer blog, but we will not provide any advance notice. + +If you have any questions or feedback, please [let us know][contact]! + +[media-type]: /v3/media +[docs]: /v3/repos/traffic/ +[contact]: https://github.com/contact?form%5Bsubject%5D=Traffic+API diff --git a/content/v3/repos/traffic.md b/content/v3/repos/traffic.md new file mode 100644 index 0000000000..483197db77 --- /dev/null +++ b/content/v3/repos/traffic.md @@ -0,0 +1,79 @@ +--- +title: Traffic +--- + +# Traffic +{{#tip}} + + + + APIs for repository traffic are currently available for developers to preview. + During the preview period, the APIs may change without advance notice. + Please see the [blog post](/changes/2016-08-15-traffic-api-preview) for full details. + + To access the API you must provide a custom [media type](/v3/media) in the `Accept` header: + + application/vnd.github.spiderman-preview + +{{/tip}} + +{:toc} + +For repositories that you have push access to, the traffic API provides access +to the information provided in the [graphs section](https://help.github.com/articles/about-repository-graphs/#traffic). + + + +## List referrers + +Get the top 10 referrers over the last 14 days. + + GET /repos/:owner/:repo/traffic/popular/referrers + +### Response + +<%= headers 200 %> +<%= json(:traffic_referrers) %> + +## List paths + +Get the top 10 popular contents over the last 14 days. + + GET /repos/:owner/:repo/traffic/popular/paths + +### Response + +<%= headers 200%> +<%= json(:traffic_contents) %> + +## Views + +Get the total number of views and breakdown per day or week for the last 14 days. + + GET /repos/:owner/:repo/traffic/views + +### Parameters +Name | Type | Description +-----|------|-------------- +`per`|string|Must be one of: `day`, `week`. Default: `day` + + +### Response +<%= headers 200 %> +<%= json(:traffic_views) %> + +## Clones + +Get the total number of clones and breakdown per day or week for the last 14 days. + + GET /repos/:owner/:repo/traffic/clones + +### Parameters +Name | Type | Description +-----|------|-------------- +`per`|string|Must be one of: `day`, `week`. Default: `day` + +### Response + +<%= headers 200 %> +<%= json(:traffic_clones) %> diff --git a/layouts/sidebar.html b/layouts/sidebar.html index 35dd666473..46f010e310 100644 --- a/layouts/sidebar.html +++ b/layouts/sidebar.html @@ -118,6 +118,9 @@

    Releases
  • Statistics
  • Statuses
  • + <% if @item[:version] == 'dotcom' %> +
  • Traffic
  • + <% end %>
  • Webhooks
  • <% if @item[:version].is_a?(Numeric) && @item[:version] >= 2.7 %>
  • Pre-receive Hooks (Enterprise)
  • diff --git a/lib/responses/traffic.rb b/lib/responses/traffic.rb new file mode 100644 index 0000000000..ff8e8cb0ba --- /dev/null +++ b/lib/responses/traffic.rb @@ -0,0 +1,94 @@ +module GitHub + module Resources + module Responses + + TRAFFIC_REFERRERS ||= [ + {"referrer" => "Google", "count" => 4, "uniques" => 3}, + {"referrer" => "stackoverflow.com", "count" => 2, "uniques" => 2}, + {"referrer" => "eggsonbread.com", "count" => 1, "uniques" => 1}, + {"referrer" => "yandex.ru", "count" => 1, "uniques" => 1}] + + TRAFFIC_CONTENTS ||= [ + { + "path" => "/github/hubot", + "title" => "github/hubot: A customizable life embetterment robot.", + "count" => 3542, + "uniques" => 2225 + }, + { + "path" => "/github/hubot/blob/master/docs/scripting.md", + "title" => "hubot/scripting.md at master · github/hubot · GitHub", + "count" => 1707, + "uniques" => 804 + }, + { + "path" => "/github/hubot/tree/master/docs", + "title" => "hubot/docs at master · github/hubot · GitHub", + "count" => 685, + "uniques" => 435 + }, + { + "path" => "/github/hubot/tree/master/src", + "title" => "hubot/src at master · github/hubot · GitHub", + "count" => 577, + "uniques" => 347 + }, + { + "path" => "/github/hubot/blob/master/docs/index.md", + "title" => "hubot/index.md at master · github/hubot · GitHub", + "count" => 379, + "uniques" => 259 + }, + { + "path" => "/github/hubot/blob/master/docs/adapters.md", + "title" => "hubot/adapters.md at master · github/hubot · GitHub", + "count" => 354, + "uniques" => 201 + }, + { + "path" => "/github/hubot/tree/master/examples", + "title" => "hubot/examples at master · github/hubot · GitHub", + "count" => 340, + "uniques" => 260 + }, + { + "path" => "/github/hubot/blob/master/docs/deploying/heroku.md", + "title" => "hubot/heroku.md at master · github/hubot · GitHub", + "count" => 324, + "uniques" => 217 + }, + { + "path" => "/github/hubot/blob/master/src/robot.coffee", + "title" => "hubot/robot.coffee at master · github/hubot · GitHub", + "count" => 293, + "uniques" => 191 + }, + { + "path" => "/github/hubot/blob/master/LICENSE.md", + "title" => "hubot/LICENSE.md at master · github/hubot · GitHub", + "count" => 281, + "uniques" => 222 + }] + + TRAFFIC_VIEWS ||= { + "count" => 7, + "uniques" => 6, + "views" => [ + {"timestamp" => 1464710400000, "count" => 1, "uniques" => 1}, + {"timestamp" => 1464732000000, "count" => 2, "uniques" => 1}, + {"timestamp" => 1465214400000, "count" => 1, "uniques" => 1}, + {"timestamp" => 1465218000000, "count" => 1, "uniques" => 1}, + {"timestamp" => 1465300800000, "count" => 2, "uniques" => 2}]} + + TRAFFIC_CLONES ||= { + "count" => 7, + "uniques" => 6, + "clones" => [ + {"timestamp" => 1464710400000, "count" => 1, "uniques" => 1}, + {"timestamp" => 1464732000000, "count" => 2, "uniques" => 1}, + {"timestamp" => 1465214400000, "count" => 1, "uniques" => 1}, + {"timestamp" => 1465218000000, "count" => 1, "uniques" => 1}, + {"timestamp" => 1465300800000, "count" => 2, "uniques" => 2}]} + end + end +end From 3f411bda1309466a7fd1da5092801e52b0ef103f Mon Sep 17 00:00:00 2001 From: Hubot Date: Tue, 16 Aug 2016 04:50:19 -0700 Subject: [PATCH 48/54] Sync changes from upstream repository --- content/v3/users.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/v3/users.md b/content/v3/users.md index d8caa605d1..11e5479a4c 100644 --- a/content/v3/users.md +++ b/content/v3/users.md @@ -68,7 +68,7 @@ Name | Type | Description ## Get all users -Lists all users, in the order that they signed up on {{ site.data.variables.product.product_name }}. +Lists all users, in the order that they signed up on {{ site.data.variables.product.product_name }}. This list includes personal user accounts and organization accounts. Note: Pagination is powered exclusively by the `since` parameter. Use the [Link header](/v3/#link-header) to get the URL for the next page of From 9190dd5a0719f666bdcfe52e808d0ce0624cdedb Mon Sep 17 00:00:00 2001 From: Jeff Schering Date: Wed, 17 Aug 2016 10:42:15 -0700 Subject: [PATCH 49/54] Update basics-of-authentication.md Deleted an extra in the views/index.erb sample, line 68 --- content/guides/basics-of-authentication.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/guides/basics-of-authentication.md b/content/guides/basics-of-authentication.md index 180f1a3ccd..f67f9e8f0e 100644 --- a/content/guides/basics-of-authentication.md +++ b/content/guides/basics-of-authentication.md @@ -65,7 +65,7 @@ Next, in _views/index.erb_, paste this content:

    We're going to now talk to the GitHub API. Ready? - Click here to begin! + Click here to begin!

    If that link doesn't work, remember to provide your own Client ID! From cb063a6aa0b6918b230934c6017160eb4c01cf2f Mon Sep 17 00:00:00 2001 From: Hubot Date: Tue, 23 Aug 2016 14:51:30 -0700 Subject: [PATCH 50/54] Sync changes from upstream repository --- content/changes/2016-08-23-change-base.md | 25 +++++++++++++++++++++++ content/v3/pulls.md | 10 ++++++--- 2 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 content/changes/2016-08-23-change-base.md diff --git a/content/changes/2016-08-23-change-base.md b/content/changes/2016-08-23-change-base.md new file mode 100644 index 0000000000..a83f67b8e3 --- /dev/null +++ b/content/changes/2016-08-23-change-base.md @@ -0,0 +1,25 @@ +--- +title: API changes for changing the base branch on Pull Requests +author_name: scottjg +--- +GitHub recently added the ability to [change the base branch][blog post] on a Pull Request after it's created. Now we're updating the Pull Request API to enable the new functionality. + +For example: + +``` command-line +curl "https://api.github.com/repos/github/hubot/pulls/123" \ + -H 'Authorization: token TOKEN' \ + -d '{ "base": "master" }' +``` + +The Pull Request base will be updated to point to the master branch. + +You can learn more about the new responses and endpoints in the updated [Pull Request][pulls] documentation. + +If you have any questions or feedback, please [let us know][contact]! + + +[pulls]: /v3/pulls +[blog post]: https://github.com/blog/2224-change-the-base-branch-of-a-pull-request +[contact]: https://github.com/contact?form%5Bsubject%5D=Change+base+on+Pull+Requests + diff --git a/content/v3/pulls.md b/content/v3/pulls.md index 7d73679708..332c98ff3d 100644 --- a/content/v3/pulls.md +++ b/content/v3/pulls.md @@ -87,7 +87,7 @@ Name | Type | Description -----|------|------------- `title`|`string` | **Required**. The title of the pull request. `head`|`string` | **Required**. The name of the branch where your changes are implemented. For cross-repository pull requests in the same network, namespace `head` with a user like this: `username:branch`. -`base`|`string` | **Required**. The name of the branch you want your changes pulled into. This should be an existing branch on the current repository. You cannot submit a pull request to one repository that requests a merge to a base of another repository. +`base`|`string` | **Required**. The name of the branch you want the changes pulled into. This should be an existing branch on the current repository. You cannot submit a pull request to one repository that requests a merge to a base of another repository. `body`|`string` | The contents of the pull request. @@ -132,14 +132,18 @@ Name | Type | Description -----|------|-------------- `title`|`string` | The title of the pull request. `body`|`string` | The contents of the pull request. -`state`|`string` | State of this Pull Request. Either `open` or `closed`. +`state`|`string` | State of this Pull Request. Either `open` or `closed`.{% if page.version == 'dotcom' or page.version >= 2.8 %} +`base`|`string` | The name of the branch you want your changes pulled into. This should be an existing branch on the current repository. You cannot update the base branch on a pull request to point to another repository. +{% endif %} #### Example <%= json \ :title => "new title", :body => "updated body", - :state => "open" + :state => "open"{% if page.version == 'dotcom' or page.version >= 2.8 %}, + :base => "master" +{% endif %} %> ### Response From 0e5a5b8fc39140d9688a2bbb0b999057adfecb1f Mon Sep 17 00:00:00 2001 From: Morton Fox Date: Wed, 31 Aug 2016 00:16:45 -0400 Subject: [PATCH 51/54] Update the pull request help link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7a1e3bfcc9..fd73c1d298 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ This is a GitHub API resource built with [Nanoc][nanoc]. -All submissions are welcome. To submit a change, fork this repo, commit your changes, and send us a [pull request](http://help.github.com/send-pull-requests/). +All submissions are welcome. To submit a change, fork this repo, commit your changes, and send us a [pull request](https://help.github.com/articles/creating-a-pull-request/). ## Development From 6e3b1dac0fa8654fdd6503d17f9a6a4337ab69fd Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Fri, 2 Sep 2016 23:12:03 -0700 Subject: [PATCH 52/54] No longer necessary. --- CNAME | 1 - 1 file changed, 1 deletion(-) delete mode 100644 CNAME diff --git a/CNAME b/CNAME deleted file mode 100644 index 82c2e93c12..0000000000 --- a/CNAME +++ /dev/null @@ -1 +0,0 @@ -developer.github.com From 64f712176ee30c47ea7a20231c38d72e61529e40 Mon Sep 17 00:00:00 2001 From: Hubot Date: Thu, 8 Sep 2016 18:26:53 -0500 Subject: [PATCH 53/54] Update README --- README.md | 302 ++++++++++++++++++++++++------------------------------ 1 file changed, 136 insertions(+), 166 deletions(-) diff --git a/README.md b/README.md index fd73c1d298..620e7a2091 100644 --- a/README.md +++ b/README.md @@ -1,166 +1,136 @@ -# developer.github.com [![Build Status](https://travis-ci.org/github/developer.github.com.svg?branch=master)](https://travis-ci.org/github/developer.github.com) - - -This is a GitHub API resource built with [Nanoc][nanoc]. - -All submissions are welcome. To submit a change, fork this repo, commit your changes, and send us a [pull request](https://help.github.com/articles/creating-a-pull-request/). - -## Development - -You can fetch the latest dependencies by opening the command line and running `script/bootstrap`: - -``` sh -$ script/bootstrap -==> Installing gem dependencies… -==> Installing npm dependencies… -``` - -You'll need Ruby and Node installed on your system. The required versions for each of these languages can be found in the *.ruby-version* and *package.json* files, respectively. - -You can run `bundle exec rake build` to generate the site, but it's often more useful -to simply build the server *and* start the site at the same time. - -Nanoc compiles the site into static files living in `output`. It's -smart enough not to try to compile unchanged files. - -You can start the site with `script/server`: - -``` sh -$ script/server -Loading site data... -Compiling site... - create [0.28s] output/index.html - create [1.31s] output/v3/gists/comments/index.html - identical [1.92s] output/v3/gists/index.html - identical [0.25s] output/v3/issues/comments/index.html - update [0.99s] output/v3/issues/labels/index.html - update [0.05s] output/v3/index.html - … - -Site compiled in 5.81s. -``` - -The site is hosted at `http://localhost:4000`. - -Nanoc has [some nice documentation](http://nanoc.ws/docs/tutorial/) to get you started. Though if you're mainly concerned with editing or adding content, you won't need to know much about Nanoc. - -[nanoc]: http://nanoc.ws/ - -### Enterprise - -To generate the `/enterprise` versions, pass in the Enterprise version to `script/server`. For example: - -``` sh -$ script/server 2.6 -``` - -Note that live reloading is not available for Enterprise documentation. - -## Styleguide - -Not sure how to structure the docs? Here's what the structure of the -API docs should look like: - - # API title - - {:toc} - - ## API endpoint title - - [VERB] /path/to/endpoint - - ### Parameters - - Name | Type | Description - -----|------|-------------- - `name`|`type` | Description. - - ### Input (request JSON body) - - Name | Type | Description - -----|------|-------------- - `name`|`type` | Description. - - ### Response - - <%= headers 200, :pagination => default_pagination_rels, 'X-Custom-Header' => "value" %> - <%= json :resource_name %> - -**Note**: We're using [Kramdown Markdown extensions](http://kramdown.gettalong.org/syntax.html), such as definition lists. - -### JSON Responses - -We specify the JSON responses in Ruby so that we don't have to write -them by hand all over the docs. You can render the JSON for a resource -like this: - -```erb -<%= json :issue %> -``` - -This looks up `GitHub::Resources::ISSUE` in `lib/resources.rb`. - -Some actions return arrays. You can modify the JSON by passing a block: - -```erb -<%= json(:issue) { |hash| [hash] } %> -``` - -There is also a rake task for generating JSON files from the sample responses in the documentation: - -``` sh -$ rake generate_json_from_responses -``` - -The generated files will end up in *json-dump/*. - -### Terminal blocks - -You can specify terminal blocks by using the `command-line` syntax highlighting. - - ``` command-line - $ curl foobar - ``` - -You can use certain characters, like `$` and `#`, to emphasize different parts -of commands. - - ``` command-line - # call foobar - $ curl foobar - .... - ``` - -For more information, see [the reference documentation](https://github.com/gjtorikian/extended-markdown-filter#command-line-highlighting). - -## Deploy - -Deployments happen automatically once a PR is merged into `master`. A tool called [Publisher](https://github.com/gjtorikian/publisher) takes the `master` branch, builds it using Nanoc, and publishes the content to `gh-pages`. Thus, any commit to `master` is automatically sent over to `gh-pages`, where it's picked up and served by GitHub Pages. - -## Licenses - -The code to generate the site (everything excluding the assets, content, -and layouts directories) as well as the code samples on the site are -licensed under -[CC0-1.0](https://creativecommons.org/publicdomain/zero/1.0/legalcode). -CC0 waives all copyright restrictions but does not grant you any trademark -permissions. - -Site content (everything in the assets, content, and layouts directories, -excluding files under open source licenses individually marked) is licensed -under [CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/). CC-BY-4.0 -gives you permission to use content for almost any purpose but does not grant -you any trademark permissions, so long as you note the license and give credit, -such as follows: - -> Content based on -> developer.github.com -> used under the -> CC-BY-4.0 -> license. - -This means you can use the code and content in this repository except for -GitHub trademarks in your own projects. - -When you contribute to this repository you are doing so under the above -licenses. +IyBkZXZlbG9wZXIuZ2l0aHViLmNvbQoKKipOT1RFOiBUaGUgZGV2ZWxvcGVy +LmdpdGh1Yi5jb20gd2Vic2l0ZSBpcyBubyBsb25nZXIgb3Blbi1zb3VyY2Uu +KioKCldlIGhhdmUgbW92ZWQgdGhpcyByZXBvc2l0b3J5IGludG8gW291ciBn +aXRodWItYXJjaGl2ZSBvcmdhbml6YXRpb25dKGh0dHBzOi8vZ2l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saWNlbnNlIGFuZCBnaXZlIGNyZWRpdCwKc3VjaCBhcyBmb2xs +b3dzOgoKPiBDb250ZW50IGJhc2VkIG9uCj4gPGEgaHJlZj0iaHR0cHM6Ly9n +aXRodWIuY29tL2dpdGh1Yi9kZXZlbG9wZXIuZ2l0aHViLmNvbSI+ZGV2ZWxv +cGVyLmdpdGh1Yi5jb208L2E+Cj4gdXNlZCB1bmRlciB0aGUKPiA8YSBocmVm +PSJodHRwczovL2NyZWF0aXZlY29tbW9ucy5vcmcvbGljZW5zZXMvYnkvNC4w +LyI+Q0MtQlktNC4wPC9hPgo+IGxpY2Vuc2UuPC9hPgoKVGhpcyBtZWFucyB5 +b3UgY2FuIHVzZSB0aGUgY29kZSBhbmQgY29udGVudCBpbiB0aGlzIHJlcG9z +aXRvcnkgZXhjZXB0IGZvcgpHaXRIdWIgdHJhZGVtYXJrcyBpbiB5b3VyIG93 +biBwcm9qZWN0cy4KCldoZW4geW91IGNvbnRyaWJ1dGUgdG8gdGhpcyByZXBv +c2l0b3J5IHlvdSBhcmUgZG9pbmcgc28gdW5kZXIgdGhlIGFib3ZlCmxpY2Vu +c2VzLgo= From a03030dea7be744a3feff20ea29f51783f37a47f Mon Sep 17 00:00:00 2001 From: Hubot Date: Thu, 8 Sep 2016 18:27:26 -0500 Subject: [PATCH 54/54] Update README --- README.md | 312 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 176 insertions(+), 136 deletions(-) diff --git a/README.md b/README.md index 620e7a2091..d73feafde0 100644 --- a/README.md +++ b/README.md @@ -1,136 +1,176 @@ -IyBkZXZlbG9wZXIuZ2l0aHViLmNvbQoKKipOT1RFOiBUaGUgZGV2ZWxvcGVy -LmdpdGh1Yi5jb20gd2Vic2l0ZSBpcyBubyBsb25nZXIgb3Blbi1zb3VyY2Uu -KioKCldlIGhhdmUgbW92ZWQgdGhpcyByZXBvc2l0b3J5IGludG8gW291ciBn -aXRodWItYXJjaGl2ZSBvcmdhbml6YXRpb25dKGh0dHBzO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IHRoZSBsaWNlbnNlIGFuZCBnaXZlIGNyZWRpdCwKc3VjaCBhcyBmb2xs -b3dzOgoKPiBDb250ZW50IGJhc2VkIG9uCj4gPGEgaHJlZj0iaHR0cHM6Ly9n -aXRodWIuY29tL2dpdGh1Yi9kZXZlbG9wZXIuZ2l0aHViLmNvbSI+ZGV2ZWxv -cGVyLmdpdGh1Yi5jb208L2E+Cj4gdXNlZCB1bmRlciB0aGUKPiA8YSBocmVm -PSJodHRwczovL2NyZWF0aXZlY29tbW9ucy5vcmcvbGljZW5zZXMvYnkvNC4w -LyI+Q0MtQlktNC4wPC9hPgo+IGxpY2Vuc2UuPC9hPgoKVGhpcyBtZWFucyB5 -b3UgY2FuIHVzZSB0aGUgY29kZSBhbmQgY29udGVudCBpbiB0aGlzIHJlcG9z -aXRvcnkgZXhjZXB0IGZvcgpHaXRIdWIgdHJhZGVtYXJrcyBpbiB5b3VyIG93 -biBwcm9qZWN0cy4KCldoZW4geW91IGNvbnRyaWJ1dGUgdG8gdGhpcyByZXBv -c2l0b3J5IHlvdSBhcmUgZG9pbmcgc28gdW5kZXIgdGhlIGFib3ZlCmxpY2Vu -c2VzLgo= +# developer.github.com + +**NOTE: The developer.github.com website is no longer open-source.** + +We have moved this repository into [our github-archive organization](https://github.com/github-archive) to signify that we are no longer accepting open-source contributions to this repository. We want to thank the hundreds of contributors for their assistance over the years. + +The decision to close-source the site stems from a variety of reasons: + +1. We actually already _have_ a close-sourced site, which is where we wrote documentation for unreleased features. We designed additional tooling to support this workflow, but updating the documentation is a process we'd like to simplify. +2. We believe that any open-source project—be it documentation or software—ought to have dedicated maintainers. It became difficult to keep this repository open-source because it was maintained by the best efforts of a small group of people. Closing the site allows us to focus on what's important, without feeling guilty at missing reviews from open-source contributors. + +We think that the tooling we used to build this site is pretty interesting, so we're not getting rid of everything. We hope that what remains can be used as a source of inspiration for your own static site. + +If you find something that needs to be fixed, you can always [contact our terrific Support team](https://github.com/contact?form%5Bsubject%5D=Moving+developer.github.com+to+github-archive). + +Thank you! + +* * * + +This was the GitHub API documentation, built with [Nanoc][nanoc]. + +## Development + +You can fetch the latest dependencies by opening the command line and running `script/bootstrap`: + +``` sh +$ script/bootstrap +==> Installing gem dependencies… +==> Installing npm dependencies… +``` + +You'll need Ruby and Node installed on your system. The required versions for each of these languages can be found in the *.ruby-version* and *package.json* files, respectively. + +You can run `bundle exec rake build` to generate the site, but it's often more useful +to simply build the server *and* start the site at the same time. + +Nanoc compiles the site into static files living in `output`. It's +smart enough not to try to compile unchanged files. + +You can start the site with `script/server`: + +``` sh +$ script/server +Loading site data... +Compiling site... + create [0.28s] output/index.html + create [1.31s] output/v3/gists/comments/index.html + identical [1.92s] output/v3/gists/index.html + identical [0.25s] output/v3/issues/comments/index.html + update [0.99s] output/v3/issues/labels/index.html + update [0.05s] output/v3/index.html + … + +Site compiled in 5.81s. +``` + +The site is hosted at `http://localhost:4000`. + +Nanoc has [some nice documentation](http://nanoc.ws/docs/tutorial/) to get you started. Though if you're mainly concerned with editing or adding content, you won't need to know much about Nanoc. + +[nanoc]: http://nanoc.ws/ + +### Enterprise + +To generate the `/enterprise` versions, pass in the Enterprise version to `script/server`. For example: + +``` sh +$ script/server 2.6 +``` + +Note that live reloading is not available for Enterprise documentation. + +## Styleguide + +Not sure how to structure the docs? Here's what the structure of the +API docs should look like: + + # API title + + {:toc} + + ## API endpoint title + + [VERB] /path/to/endpoint + + ### Parameters + + Name | Type | Description + -----|------|-------------- + `name`|`type` | Description. + + ### Input (request JSON body) + + Name | Type | Description + -----|------|-------------- + `name`|`type` | Description. + + ### Response + + <%= headers 200, :pagination => default_pagination_rels, 'X-Custom-Header' => "value" %> + <%= json :resource_name %> + +**Note**: We're using [Kramdown Markdown extensions](http://kramdown.gettalong.org/syntax.html), such as definition lists. + +### JSON Responses + +We specify the JSON responses in Ruby so that we don't have to write +them by hand all over the docs. You can render the JSON for a resource +like this: + +```erb +<%= json :issue %> +``` + +This looks up `GitHub::Resources::ISSUE` in `lib/resources.rb`. + +Some actions return arrays. You can modify the JSON by passing a block: + +```erb +<%= json(:issue) { |hash| [hash] } %> +``` + +There is also a rake task for generating JSON files from the sample responses in the documentation: + +``` sh +$ rake generate_json_from_responses +``` + +The generated files will end up in *json-dump/*. + +### Terminal blocks + +You can specify terminal blocks by using the `command-line` syntax highlighting. + + ``` command-line + $ curl foobar + ``` + +You can use certain characters, like `$` and `#`, to emphasize different parts +of commands. + + ``` command-line + # call foobar + $ curl foobar + .... + ``` + +For more information, see [the reference documentation](https://github.com/gjtorikian/extended-markdown-filter#command-line-highlighting). + +## Licenses + +The code to generate the site (everything excluding the assets, content, +and layouts directories) as well as the code samples on the site are +licensed under +[CC0-1.0](https://creativecommons.org/publicdomain/zero/1.0/legalcode). +CC0 waives all copyright restrictions but does not grant you any trademark +permissions. + +Site content (everything in the assets, content, and layouts directories, +excluding files under open source licenses individually marked) is licensed +under [CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/). CC-BY-4.0 +gives you permission to use content for almost any purpose but does not grant +you any trademark permissions, so long as you note the license and give credit, +such as follows: + +> Content based on +> developer.github.com +> used under the +> CC-BY-4.0 +> license. + +This means you can use the code and content in this repository except for +GitHub trademarks in your own projects. + +When you contribute to this repository you are doing so under the above +licenses.