メモ
This feature is in パブリック プレビュー 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 リポジトリのコード カバレッジの設定.
Creating a coverage threshold rule
-
GitHub で、リポジトリのメイン ページに移動します。
-
リポジトリ名の下にある [Settings] をクリックします。 [設定] タブが表示されない場合は、 [] ドロップダウン メニューを選び、 [設定] をクリックします。
![タブを示すリポジトリ ヘッダーのスクリーンショット。 [設定] タブが濃いオレンジ色の枠線で強調表示されています。](/assets/cb-28260/images/help/repository/repo-actions-settings.png)
-
左側のサイド バーの [コードと自動化] の下で、 [ルール] をクリックし、 [ルールセット] をクリックします。
![リポジトリの [設定] ページのサイド バーのスクリーンショット。 [ルール] サブメニューが展開され、[ルールセット] オプションの枠線がオレンジ色で表示されています。](/assets/cb-80504/images/help/repository/rulesets-settings.png)
-
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.
ヒント
Consider setting your ruleset to Evaluate mode before switching to Active. This lets you observe which pull requests would have been blocked without enforcing the rule, giving you a chance to calibrate your thresholds.