Skip to content
Latchkey

How to Require Status Checks with Branch Protection

Required status checks live in branch protection and block a merge; a badge only displays a result and enforces nothing.

Add a branch protection rule that lists the checks that must pass. The check name is the job name reported to the commit. A badge on the README shows status but has no effect on merges.

Steps

  • Open Settings to Branches and add a rule for main.
  • Enable "Require status checks to pass before merging".
  • Select the check by its job name (it appears after it has run once).

The job whose name becomes the check

.github/workflows/ci.yml
jobs:
  build-and-test:
    name: build-and-test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: npm ci && npm test

Badge vs check

  • A badge is a read-only image; anyone can see it but it never blocks anything.
  • A required status check is enforcement configured in branch protection, keyed on the check name.
  • A green badge with a broken required check still blocks the merge, and vice versa.

Gotchas

  • A check must run at least once before it appears in the selection list.
  • Renaming a job changes the check name and silently drops it from the required list.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →