Skip to main content
RunBook Academy

Git, CI/CD & GitOpsXXX · Pull Requests and Merge RequestsStatusChecks

Status checks — the automated gate and the cost of flakiness

Intermediate⏱ ~21 mingit

What you'll learn

  • Explain what a status check is and where it comes from — CI, forge-side, or external integration
  • Distinguish required from optional checks and the role of the required check in the merge gate
  • Recognise the production cost of flaky checks and the four-step recipe for retiring them
  • Read the checks panel of a PR and identify which check corresponds to which policy

Prerequisites

Verified against Git 2.55.x teaching target; 2.40+ minimum · GitHub Actions continuous service; Aug 2026 documentation baseline · Argo CD v3.5.x teaching target; v3.0+ minimum · Flux v2.9.x · Sigstore Cosign v3.1.x · SLSA v1.2 · OCI Distribution Specification v1.1 · Git LFS v3.7.1 · Kubernetes (cross-course target) 1.36.x

Not yet marked complete on this device.

A status check is an assertion from a system — the CI pipeline, the forge itself, or an external integration — that the PR satisfies a policy. The forge aggregates these into a single green-or-red signal on the merge button. The cost of a flaky check is paid by every engineer who has to wait for a re-run and every auditor who cannot tell a real pass from a rerun-of-shame.

What a status check is

A status check has three properties: a name, a state (success, failure, pending, or neutral), and a URL pointing at the system that produced it. The check is registered against the commit SHA — so a force-push invalidates the old checks.

gh pr checks
gh pr status

There are three sources of status checks. CI checks come from the pipeline — GitHub Actions, GitLab CI, Jenkins. Forge-side checks come from the forge itself — branch protection, signed-commit enforcement. External checks come from third-party services — code scanning, secret scanning, dependency review.

flowchart LR
    PR["PR commit SHA"] --> A["CI: terraform plan"]
    PR --> B["Forge: signed commits"]
    PR --> C["External: secret scanning"]
    A --> G["required gate"]
    B --> G
    G --> M["merge button"]
    C -. "informational" .-> M

Required versus optional

A required check is one whose name appears in the protected branch’s required-checks list; the merge button enables only when every required check is green. A check that determines whether the change is correct — terraform plan, unit tests — is a required check. A check that determines whether the change is also good — code coverage, lint — is often optional. The trade-off is the cost of a false positive.

The cost of flaky checks

A flaky check fails on a re-run of the same commit. The CI literature reports one to five percent flakiness; the rate climbs with shared state, network, or time dependencies. A 3% rate means roughly one in thirty merges is delayed by a re-run.

The four-step recipe for retiring flaky checks:

  1. Measure. Track which checks are re-run.
  2. Quarantine. Move the flaky check out of the required list. The check still runs.
  3. Fix or remove. Fix if possible; remove if not.
  4. Restore or replace. Once reliable, return it. Otherwise find a different check.

Production discipline

  1. Required checks are few and fast. Five at twenty minutes total beats fifteen at an hour.
  2. Flakiness is measured. Track re-run rates; quarantine checks above 5%.
  3. Required checks are deterministic. No required check should depend on shared mutable state, the network, or the wall clock.
  4. Optional checks are visible. A reviewer should see them in the PR view.
  5. Bypass requires reason. The reason field is what the auditor reads.

Cross-course references

  • CI/CD Pipeline Patterns - Part III (FastCI): the fast-CI discipline that keeps required checks in minutes.
  • GitOps with Argo CD - Part IV (SyncPatterns): the GitOps-side equivalent of required checks.
  • Terraform for Production Sysadmins - Part XI (PRWorkflows): Terraform-specific required checks (terraform plan, tflint, checkov).

Quiz

Knowledge check · 4 questions

  1. Q1. A PR has four status checks. Two are required, two are optional. One required check is green, the other is red, and one optional check is red. What is the state of the merge button?

  2. Q2. A flaky check that is re-run half the time is acceptable as a required check if the team has learned to re-run it on demand.

  3. Q3. Name the four steps of the recipe for retiring a flaky required check.

  4. Q4. Diagnose a stalled infrastructure team whose required checks have drifted from fast-and-deterministic to slow-and-flaky.

    A platform team reports PR merges take two hours on average. The required-checks list has nine entries; one is `integration-tests` running against a shared staging cluster and re-run on 18% of PRs. The `terraform plan` check takes twelve minutes; `checkov` takes twenty-two. Approvals are quick but the merge is blocked by red checks more than half the time.

Passing score: 75%. Answers are checked in this browser.