New API parameters for project card archiving

We're adding some API parameters to support the new project card archiving feature.

Archiving and restoring a project's cards

To archive a card, use the Update a project card API endpoint, passing true for the archived parameter. To restore an archived card, use the same API endpoint, passing false for the archived parameter.

Viewing a column's archived cards

When using the List project cards API endpoint, you can now specify whether or not you'd like to see a column's archived cards. By default, you will only see cards in the column that are not archived, but if you pass "archived" for the archived_state parameter, you will see that column's archived cards instead. If you pass "all" for the archived_state parameter, you will see every card in the column, whether or not it is archived.

Preview period

To access these new parameters during the preview period, you must provide a custom media type in the Accept header:

application/vnd.github.inertia-preview+json

During the preview period, we may change aspects of these API parameters 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!

New endpoints to find app installations

We've released new endpoints to help you find installations of your app for a given organization, repository, or user.

When authenticated as a GitHub App, you can now use the following endpoints:

How can I try it?

To access this functionality, you’ll need to provide the following custom media type in the Accept header:

application/vnd.github.machine-man-preview+json

If you have any questions or feedback, please let us know on the platform forum.

Global node IDs become an official part of REST API v3

The node_id attribute, used to identify objects in our GraphQL API from our REST API, has just graduated from preview for GitHub dotcom and GitHub Enterprise versions 2.14 and higher. The node_id attribute will be included in all supported REST resources that have a corresponding GraphQL object, and you can use this information to help move between the REST API and the GraphQL API. For more information, see "Migrating from REST to GraphQL" and "Using global node IDs."

Preview media type no longer needed

Now that the preview period has ended (first announced in December 2017), you no longer need to pass this custom media type. Instead, we recommend that you specify v3 as the version in the Accept header:

application/vnd.github.v3+json

Please note that if you use GitHub Enterprise versions 2.11 through 2.13, you will still need to provide a custom media type in the Accept header:

application/vnd.github.jean-grey-preview+json

Onward! Thanks again to everyone that tried out GraphQL global node IDs during the preview period. If you have any questions or feedback, please let us know on the GitHub Platform Forum.

User Migration API public beta

Starting today, both users and organizations now have the ability to request an archive of their repositories, issues, comments, and other data using the Migrations API.

To access this new API during the preview period, you must provide a custom media type in the Accept header:

application/vnd.github.wyandotte-preview+json

During the preview period, we may change aspects of these API methods based on your feedback. If we do, we'll announce the changes here on the developer blog, but we won't provide advance notice.

Requesting a user migration archive

Before you can download an archive of your data, you must first export it. To start a migration, make a POST request to the /user/migrations endpoint, listing the repositories you'd like to include in the archive:

curl -X POST -H "Accept: application/vnd.github.wyandotte-preview+json" -u USERNAME:TOKEN --data '{"repositories":["USERNAME/REPO", "USERNAME/ANOTHER_REPO"]}' https://api.github.com/user/migrations

Checking the status of a migration

After you've started a migration, you can check the status of your archive by making a GET request to the /user/migrations/:migration_id endpoint, using the migration ID provided in the response to your initial request (or as retrieved from GET /user/migrations):

curl -X GET -H "Accept: application/vnd.github.wyandotte-preview+json" -u USERNAME:TOKEN https://api.github.com/user/migrations/:migration_id

Retrieving the archive URL

Once your migration is in the exported state, you can request the URL to your migration archive by making a GET request to the /user/migrations/:migration_id/archive endpoint. This endpoint will return an authenticated URL which you can use to retrieve your archive as a tar.gz file:

curl -X GET -H "Accept: application/vnd.github.wyandotte-preview+json" -u USERNAME:TOKEN https://api.github.com/user/migrations/:migration_id/archive

Deleting an archive

Your migration archive will remain available to download for seven days. If you would like to delete your archive sooner, you can do so by making a DELETE request to the /user/migrations/:migration_id/archive endpoint:

curl -X DELETE -H "Accept: application/vnd.github.wyandotte-preview+json" -u USERNAME:TOKEN https://api.github.com/user/migrations/:migration_id/archive

While the migration will continue to exist, the exported archive and its contents will not.

Exporting all user-owned repositories

[Updated 07-05-18] If you'd like to export all your repositories and have Ruby installed, you can use the following code to conveniently generate a list of repository names to supply in the body of the POST /user/migrations request:

gem install octokit
OCTOKIT_ACCESS_TOKEN=TOKEN ruby -e "require 'octokit'; puts Octokit::Client.new(auto_paginate: true).repos(nil, type: :owner).map(&:full_name).to_json"

If you'd prefer to make the necessary API request(s) yourself, you can retrieve a list of your repositories by making a GET request to the List repositories for the authenticated user endpoint:

curl -u USERNAME:TOKEN https://api.github.com/user/repos?type=owner&per_page=100

Please note, however, that if you have more than 100 repositories, you'll need to follow the instructions for paginating requests.

We hope these endpoints can help users to back up or archive their repository data and better understand what information GitHub stores on their behalf.

If you have any questions or feedback, please get in touch with us.

Request further actions from a check run

Building on the recent Checks API, we're providing further actions that users can request from a check run. This feature enables users to select an action offered by the app. For example, users can push a button in GitHub to request that the app fixes previously found linter errors.

Workflow

  1. The integrator indicates that they can apply a further action. We designed these actions to be flexible for the integrator to specify which actions they can offer the user.

    For example, a linter type app with the ability to fix any failures found includes a "Fix" option, along with the check run input in the new actions input parameter:

    "actions": [{
        "label": "Fix",
        "description": "Let us fix that for you",
        "identifier": "fix_errors"
    }]
    
  2. GitHub surfaces possible actions for that check run in the pull request view.

    The user selects the action they want carried out. For example, they click Fix: Fix

  3. GitHub sends a webhook event to the app with the details of the user request.

    GitHub sends a check_run event with action of "requested_action" to the specific app. The payload includes the reference for the particular action requested by the user:

    "requested_action": {
      "identifier": "fix_errors"
    }
    
  4. The integrator's app carries out that action.

Use case

We used a linter app as a use case in the previous examples. This app needs write permission on the contents of the repository if you want it to apply the fixes and commit the changed code to the same branch. In GitHub, these changes might look this:

js-linter

To learn more about how an app can clone and access a repository for making changes, see "HTTP-based Git access by an installation."

How can I try it?

Anyone can register a GitHub App on GitHub through Settings > Developer settings > GitHub Apps and manage an existing GitHub App from the same place. See how to get started building GitHub Apps.

For more details, refer to the full Checks API documentation.

To access this functionality, you’ll need to provide the following custom media type in the Accept header:

application/vnd.github.antiope-preview+json

Share your feedback

We're excited to see what you build with these new improvements. If you have any questions, please let us know.

Marketplace API Out of Preview

The Marketplace API is now part of the official GitHub REST API v3.

If you used the Marketplace API during the preview period, you needed to provide a custom media type in the Accept header:

`application/vnd.github.valkyrie-preview+json`

Now that the preview period has ended, you no longer need to pass this custom media type. Instead, we recommend that you specify v3 as the version in the Accept header:

application/vnd.github.v3+json

You can find the Marketplace API here. If you have any questions or feedback, please get in touch with us.

Additional endpoints available for GitHub Apps

As part of the ongoing audit of the availability of REST API endpoints for GitHub Apps, we've enabled another batch of endpoints. For a complete list of endpoints enabled for GitHub Apps, see "Available endpoints".

Recently enabled for both server-to-server and user-to-server endpoints:

Check Runs

Check Suites

Repo Hooks

Metadata

Recently enabled user-to-server endpoints:

Codes of Conduct

Source Imports

Repo Keys

Repos

How can I try it?

To access this functionality, you’ll need to provide the following custom media type in the Accept header:

application/vnd.github.machine-man-preview+json

What about other endpoints?

We're actively working on enabling more endpoints. Check back on the developer blog for updates when new batches become available. If you have specific requests or feedback, come chat with us in the Platform forum.

New Checks API public beta

Today we're adding new functionality which allows integrations and GitHub to communicate more comprehensively about the checks run against code changes. These changes will improve your workflow by allowing you to view feedback from code checks directly in the pull request view, see the line of code causing a problem in the diff view, “re-run” checks, and more-all within the GitHub user interface.

Check run annotation

Instead of binary pass/fail commit statuses, integrators can now report more fine-grained outcomes, such as a neutral conclusion for more informational analysis or action_required if the integrator site requires the user's attention.

Check run conclusions

We've added first-class support for common workarounds, like the ability to skip or request checks via commit message, trigger checks with a dedicated check_suite webhook event, and set preferences for when checks are triggered.

Check run GitHub UI

Integrator workflows

Automatic flow

  1. By default, we will automatically send installed applications that have the checks:write permission a check_suite webhook event with the action requested. When an app receives this event, it should perform its analysis on the code changes.
  2. GitHub displays the apps that have been requested to run checks in the pull request view with a status of queued.
  3. An app creates a check run with a started_at timestamp and a status (typically in_progress) for each analysis check that the app performs.
  4. An app updates the check run and includes information about the output of its analysis.
  5. GitHub displays the output of the check run in the pull request view.
  6. Repeat steps four and five if needed. Apps can send data in stages until their analysis is complete—when it sends a completed_at timestamp and conclusion.
  7. GitHub displays all the check suites and runs data in the pull request view.

Opt out of the automatic flow

Because some checks may be expensive to run, an application can opt out of the automatic flow and instead create check suites to their preferred timing. Application owners can control this by setting their check suite preferences on a per-app and repository basis. People with admin permission on a repository can override this setting.

User workflows

Check requests via the API

The automatic flow prompts installed apps to run checks against the last commit in code pushed to a repository. A user can request to run checks for any given commit with the rerequest a check suite endpoint:

POST /repos/:owner/:repo/check-suites/:id/rerequest

Check requests via commit message

A user can control the check suite request flow on a per-commit basis:

  • To prevent a check suite from being created, include skip-checks: true in the trailers of the commit message.
  • To request a check suite, when automatic creation is disabled, include request-checks: true in the trailers of the commit message.

Note: the trailer would need to be on the last commit of a push. If you supply both trailers, skip-checks wins.

See skipping and requesting checks for individual commits for more information.

Check requests via the Web UI

A user can re-run a check run or entire check suite in the pull request view on GitHub.com.

Re-run a check run

When a user requests to re-run a check, a check_run webhook event is delivered to that app's webhook with an action of rerequested. The app is then expected to create a new check run for the given head_sha.

When a user requests to re-run a check suite, a check_suite webhook event is delivered to that app's webhook with an action of rerequested. The app is then expected to create a new check run for all its runs in that suite.

Questions

How do checks work with protected branches?

If the names of check runs are the same as the context of prior commit statuses, and those statuses were required, then the new check runs are automatically required. If a commit status and check run are created with the same name or context, both the status and the check run will be required.

If the names of the new check runs are different from the old commit statuses, the new check runs will need to be selected as required.

How are check runs different than commit statuses?

Commit statuses allow for a simple pass or fail state. Check runs allow for much more granular information: they can conclude as either success, failure, neutral, cancelled, timed_out, or action_required. Check runs are more flexible than commit statuses. You can update the lifecycle state by indicating queued, in_progress, or completed through the status field.

Check runs can be created as simply as a commit status with just a name and conclusion for the given commit. They can also include a variety of output data: textual information, images, and feedback on specific lines of code.

Is this supported in the GraphQL API?

No, but we plan to add support in the near future.

Who can use it?

The Checks API is only available to GitHub Apps through a new granular permission: checks.

How can I try it?

Anyone can register a GitHub App on GitHub through Settings > Developer settings > GitHub Apps and manage an existing GitHub App from the same place. See how to get started building GitHub Apps.

See the full Checks API documentation for more details.

To access this functionality, you’ll need to provide the following custom media type in the Accept header:

application/vnd.github.antiope-preview+json

Share your feedback

We're excited to see what you build with these new improvements. If you have any questions, please let us know.

Looking for a new app to use? Browse GitHub Marketplace.

Staying on Top of Changes in GraphQL

To provide a more seamless experience we prefer to continuously evolve our schemas rather than using API versioning. Continuous evolution allows us to iterate faster and provide our integrators with new schema members more often. We do our best to avoid breaking changes, but sometimes it's necessary to offer an unversioned API.

We strive to provide the most stable APIs to our integrators and to provide transparency about new developments. This is why we recently shipped the brand new Breaking Changes page, which announces future breaking changes to our GraphQL schema.

Internally, our engineers mark certain schema members as deprecated using a Ruby API on top of the graphql-ruby gem. Using the changes metadata provided by our engineers, we automatically compute removal dates and generate this breaking changes page, meaning you'll always get up to date information.

Along with the GraphQL Changelog, we hope this helps you build better and more stable integrations! If you have any questions or feedback, please let us know. Happy building!

The GraphQL API Now Supports GitHub Apps

GitHub Apps have been the preferred way to integrate with GitHub for nearly a year. The advantages over regular OAuth apps include granular permissions, as well as tighter control over where the Apps are installed. However, GitHub Apps could only integrate with GitHub using REST API calls.

The GraphQL API now supports requests made by GitHub Apps. This means that any query or mutation available in our public schema can be made by users authorized through a GitHub App. GraphQL is a great way to fetch data about a variety of resources in a payload that matches your request precisely. For more information on the advantages of GraphQL over REST, see "Migrating from REST."

Go forth and build amazing things! When you've finished, list your App in the GitHub Marketplace for the world to see 😉.