Description
Ensure the ruleset on the default branch requires specified status checks, such as CI builds, tests, linting, or security scans, to pass before a pull request can be merged.
Rationale
Without required status checks, a pull request can be merged even if automated builds, tests, or security scans are failing or have not run at all. Requiring these checks to pass enforces a consistent quality gate and catches regressions and vulnerabilities before they reach the default branch.
Impact
Prevents merging code that fails automated builds, tests, linting, or security scans
Catches regressions and vulnerabilities before they reach the default branch
Enforces consistent quality gates across all contributors
Reduces the operational risk of deploying broken or insecure code
Default Value
By default, no status checks are required before merging; pull requests can be merged even if CI checks are failing or have not run.
Pre-Requisites
Admin access to the repository
CI/CD workflows or checks already configured and reporting status to pull requests
Test Plan
Sign in to GitHub at https://github.com.
Select the relevant repository.
Click Settings.
In the "Code, planning, and automation" section of the sidebar, click Rulesets.
Select the ruleset that targets the default branch.
Verify that Require status checks to pass is enabled and the expected checks are listed as required.
If it is not enabled, or the required checks are missing, follow the implementation steps.
Implementation Steps
Sign in to GitHub at https://github.com.
Select the relevant repository.
Click Settings.
In the "Code, planning, and automation" section of the sidebar, click Rulesets.
Select the existing ruleset that targets the default branch, or click New ruleset, then New branch ruleset.
Under Rules, enable Require status checks to pass.
Click Add checks and select the checks that must pass, such as build, test, or security-scan workflows.
Optionally select Require branches to be up to date before merging.
Click Create, or Save changes.
Backout Plan
Sign in to GitHub at https://github.com.
Select the relevant repository.
Click Settings.
In the "Code, planning, and automation" section of the sidebar, click Rulesets.
Select the ruleset that targets the default branch.
Disable Require status checks to pass.
Click Save changes.
Reference