GitHub’s REST API can now create, update, and read the Restrict code coverage repository ruleset option. GitHub announced API management as generally available on September 18, 2026. The condition can block a pull request from merging when its line coverage misses a configured minimum or drops too far relative to the default branch. You need GitHub Code Quality enabled and coverage uploads configured before the rule can evaluate results.
What the code coverage condition enforces
The Restrict code coverage ruleset condition supports two threshold types. A repository can configure a minimum line coverage level for the pull request branch, a maximum tolerated line-coverage drop compared with the default branch, or both. A pull request is blocked from merging if either configured threshold is not met. GitHub describes the rule in its ruleset documentation.
| Threshold | What it checks | When it may fit |
|---|---|---|
| Minimum line coverage | Whether aggregated line coverage on the pull request branch is at least the configured percentage. | Use when the repository wants a floor that applies regardless of its default-branch coverage. |
| Maximum line-coverage drop | Whether the pull request branch’s coverage falls by more than the configured number of percentage points relative to the default branch. | Use when the repository wants to limit regression against its current baseline. |
The threshold should reflect the repository’s existing baseline and how its coverage is generated. GitHub’s announcement and ruleset documentation do not prescribe a numeric value, so choose one based on the project’s coverage data rather than applying an arbitrary universal target.
Prerequisites and availability
- Coverage readiness: GitHub Code Quality must be enabled, and the repository must have code coverage uploads configured.
- Eligible plans: GitHub says the feature is available on GitHub Team and GitHub Enterprise Cloud, including Enterprise Cloud with data residency. It is not available on GitHub Enterprise Server.
- API permissions: Creating or updating repository rulesets requires Administration repository permissions with write access. The REST reference examples specify
X-GitHub-Api-Version: 2026-03-10.
GitHub’s September 18, 2026 changelog announcement calls REST API management generally available. The separate ruleset feature page labels Restrict code coverage as public preview. These labels may describe different aspects—the API management release status and the feature’s status—so check the current GitHub UI and API documentation if preview status affects your rollout.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
#1 Best Overall
Manage the condition through the REST API
GitHub documents repository ruleset create, read, and update operations in its repository rulesets REST API reference. The announcement establishes that those operations can manage the code coverage option, but the generic endpoint schema available in that reference does not specify the new condition’s JSON property or exact payload shape.
For that reason, do not copy an unrelated ruleset example and assume its fields configure code coverage. Before sending a create or update request, verify the current endpoint schema or a live GitHub example for the exact condition fields. The available documentation supports the feature’s availability and behavior, but not a ready-to-run request body.
Rank #2
Make sure coverage uploads are evaluated before merge
The rule evaluates coverage data that has already been uploaded; it does not wait for uploads to finish. If an expected coverage upload has not completed when the ruleset evaluates the pull request, that result may not be included in the decision. GitHub therefore recommends making each status check associated with an expected coverage upload a required status check. This ties merge readiness to the checks that produce the data the coverage condition is meant to evaluate.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Choose an enforcement threshold
Use the minimum threshold to enforce an absolute floor, the maximum-drop threshold to constrain regression against the default branch, or both when the repository needs both safeguards. Review the project’s current baseline and ensure its coverage workflow reliably uploads the expected results before setting enforcement. No single percentage or drop limit is established as appropriate for every repository.
Quick Recap
Best Value
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




