diff --git a/CNAME b/CNAME deleted file mode 100644 index 82c2e93c12..0000000000 --- a/CNAME +++ /dev/null @@ -1 +0,0 @@ -developer.github.com diff --git a/README.md b/README.md index b0842a92cb..d73feafde0 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,23 @@ -# developer.github.com [![Build Status](https://travis-ci.org/github/developer.github.com.svg?branch=master)](https://travis-ci.org/github/developer.github.com) +# developer.github.com +**NOTE: The developer.github.com website is no longer open-source.** -This is a GitHub API resource built with [Nanoc][nanoc]. +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. -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/). +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 @@ -46,6 +60,16 @@ Nanoc has [some nice documentation](http://nanoc.ws/docs/tutorial/) to get you s [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 @@ -123,10 +147,6 @@ of commands. 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, 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-14-repository-invitations.md b/content/changes/2016-06-14-repository-invitations.md new file mode 100644 index 0000000000..00cddde89d --- /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/repos/github/hubot/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=Repository+Invitations+API+Preview 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..81fb174003 --- /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+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]! + +[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/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/changes/2016-07-06-github-pages-preview-api.md b/content/changes/2016-07-06-github-pages-preview-api.md new file mode 100644 index 0000000000..ab14cbee46 --- /dev/null +++ b/content/changes/2016-07-06-github-pages-preview-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/repos/github/developer.github.com/pages/builds" \ + -X POST + -H 'Authorization: token TOKEN' \ + -H "Accept: application/vnd.github.mister-fantastic-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/repos/github/developer.github.com/pages" \ + -H 'Authorization: token TOKEN' \ + -H "Accept: application/vnd.github.mister-fantastic-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/changes/2016-07-12-ending-multiple-assignees-preview-period.md b/content/changes/2016-07-12-ending-multiple-assignees-preview-period.md new file mode 100644 index 0000000000..13f6fc318b --- /dev/null +++ b/content/changes/2016-07-12-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/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/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/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/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! diff --git a/content/guides/delivering-deployments.md b/content/guides/delivering-deployments.md index 218cadfd9b..8644ae2d2f 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 @@ -67,7 +67,7 @@ Great! Click on **Let me select individual events.**, and select the following: * 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 @@ -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/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. 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/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/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 diff --git a/content/v3/git/commits.md b/content/v3/git/commits.md index b9cd4f22b9..69a0da52fe 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 5b98a0dd3f..b0605da270 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/issues.md b/content/v3/issues.md index dbc5f8ef7b..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,29 +215,10 @@ 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' %} - +{% if page.version == 'dotcom' or page.version >= 2.6 %} ## Lock an issue +{% if page.version == 2.6 %} {{#tip}} @@ -300,6 +232,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 +246,7 @@ Users with push access can lock an issue's conversation. ## Unlock an issue +{% if page.version == 2.6 %} {{#tip}} @@ -326,6 +260,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. diff --git a/content/v3/issues/assignees.md b/content/v3/issues/assignees.md index e6e1f8927f..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 @@ -64,24 +49,10 @@ 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 -{{#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 @@ -93,4 +64,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 %> 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/oauth.md b/content/v3/oauth.md index 62cd4711d1..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 @@ -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/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 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. 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/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 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/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 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..e620efd95c --- /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 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: + +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/content/v3/repos/collaborators.md b/content/v3/repos/collaborators.md index 2f5e94b9aa..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}} @@ -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 201 %> +<%= json(:repository_invitation) %> + ## Remove user as a collaborator DELETE /repos/:owner/:repo/collaborators/:username diff --git a/content/v3/repos/commits.md b/content/v3/repos/commits.md index 7c7fe281ca..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 @@ -98,7 +96,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/repos/invitations.md b/content/v3/repos/invitations.md new file mode 100644 index 0000000000..50469923aa --- /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 /user/repository_invitations/:invitation_id + +### Response + +<%= headers 204 %> + + + +## Decline a repository invitation + + DELETE /user/repository_invitations/:invitation_id + +### Response + +<%= headers 204 %> 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/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/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}} 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/content/v3/search.md b/content/v3/search.md index 05ca2781c1..bfdefdd175 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 @@ -93,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 @@ -182,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 @@ -285,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 @@ -357,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/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. 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 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}} 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) 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. diff --git a/layouts/sidebar.html b/layouts/sidebar.html index 54ebad1a7b..46f010e310 100644 --- a/layouts/sidebar.html +++ b/layouts/sidebar.html @@ -69,7 +69,9 @@

Licenses
  • Markdown
  • Meta
  • + <% if @item[:version] == 'dotcom' %>
  • Rate Limit
  • + <% end %>
  • @@ -78,6 +80,9 @@

    Members

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

    Repositories

  • @@ -143,6 +156,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/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/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/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 ||= { 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/issues_and_prs.rb b/lib/responses/issues_and_prs.rb index d955cb1744..847579d06a 100644 --- a/lib/responses/issues_and_prs.rb +++ b/lib/responses/issues_and_prs.rb @@ -135,8 +135,9 @@ module Responses ISSUE_WITH_ASSIGNEES ||= ISSUE.merge({ "assignees" => [ - USER.merge("login" => "hubot"), - USER.merge("login" => "other_user") + USER, + HUBOT, + OTHER_USER ] }) 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" } 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 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/lib/responses/repos.rb b/lib/responses/repos.rb index 3f1dfc5c9d..f2d1071867 100644 --- a/lib/responses/repos.rb +++ b/lib/responses/repos.rb @@ -134,6 +134,39 @@ 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" + } + + 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/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 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 }) 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 diff --git a/repository-sync b/repository-sync new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/repository-sync @@ -0,0 +1 @@ +1 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 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)