Note
This feature is in public preview and subject to change.
Prerequisites
- GitHub Code Quality is enabled on the repository.
- Code coverage data is uploaded to GitHub for the pull request branch. See Setting up code coverage for your repository.
Creating a coverage threshold rule
-
On GitHub, navigate to the main page of the repository.
-
Under your repository name, click Settings. If you cannot see the "Settings" tab, select the dropdown menu, then click Settings.

-
In the left sidebar, under "Code and automation," click Rules, then click Rulesets.

-
Create a new branch ruleset or click an existing one to edit it.
-
Under "Branch rules", select Restrict code coverage.
-
Expand Additional settings to configure thresholds. A value of 0 means that the threshold is disabled.
- Minimum coverage percentage: enter a value to block pull requests where aggregated coverage falls below this percentage.
- Maximum coverage drop: enter a value to block pull requests where coverage drops by more than this many percentage points relative to the default branch.
-
Click Create or Save changes.