Understanding GitHub status checks and PR statuses

Sara Verdi
Sara Verdi
Graphite software engineer


Note

This guide explains this concept in vanilla Git. For Graphite documentation, see our CLI docs.


GitHub addresses the integrity of code through various mechanisms like status checks and commit statuses, which help maintain code quality and prevent problematic code from being merged. This guide will explore the differences between GitHub checks and commit statuses, their role in PR management, and how they can be effectively used with tools like Graphite's PR inbox.

GitHub checks provide detailed feedback on the success or failure of tests run by integrated services like continuous integration (CI) systems. These checks can include ensuring the code compiles, linting, tests, and more. Checks can offer rich statuses, are capable of re-running specific checks, and allow for more interactive troubleshooting within the GitHub UI.

GitHub statuses provide a simpler pass/fail state linked to individual commits within a PR. They are typically used by services that need to report the outcome of a test or an analysis back to GitHub. Statuses are commonly seen in scenarios where external services such as CI tools assess the commit for any issues that might prevent it from being merged.

The main differences between GitHub checks and statuses are in their integration methods and information depth. Checks are specifically for natively integrated GitHub apps, while statuses are for external services using the GitHub REST API. Additionally, they differ in their complexity and the depth of information they provide:

  • GitHub checks are more robust, providing detailed logs, annotations directly in the code view, and a re-run capability for individual tests or checks.
  • GitHub commit statuses are more straightforward, merely showing whether a commit meets the necessary criteria to pass or fail without additional details.

In GitHub, repository administrators can set specific checks or statuses as required. This means that PRs cannot be merged until these checks are successfully passed, ensuring adherence to quality standards and build stability. Required status checks prevent the merging of unvetted code, which is critical for maintaining the health of the main branch.

When merging a PR, GitHub evaluates these checks and statuses to determine if the PR can be safely merged. This evaluation process helps enforce a workflow where only code that has passed predefined criteria is allowed to be merged, thus safeguarding the codebase against potential issues.

Graphite Protections allows administrators to set Required CI checks tailored to specific PR criteria, such as file path, team involvement, or code language, directly affecting mergeability based on the PR’s specifics. This feature is particularly beneficial in monorepos, as it ensures only relevant tests are triggered, reducing the impact of flaky tests and unnecessary delays. Integrated seamlessly with GitHub, Graphite Protections appear as status checks on PRs, preventing merges until specified conditions are met. This setup not only maintains high code quality and compliance but also allows for exceptions through overrides, such as an oncall-override label during emergencies, ensuring flexibility without compromising security or workflow integrity.

Effectively using GitHub's status checks and commit statuses can enhance your quality control processes, and by using these with Graphite Protections, you can manage PRs more efficiently to make sure each merge positively impacts your project's health and success.

Git inspired
Graphite's CLI and VS Code extension make working with Git effortless.
Learn more

Graphite
Git stacked on GitHub

Stacked pull requests are easier to read, easier to write, and easier to manage.
Teams that stack ship better software, faster.

Or install our CLI.
Product Screenshot 1
Product Screenshot 2