Creating a merge protection ruleset for a repository
-
GitHub で、リポジトリのメイン ページに移動します。
-
リポジトリ名の下にある [Settings] をクリックします。 [設定] タブが表示されない場合は、 [] ドロップダウン メニューを選び、 [設定] をクリックします。
![タブを示すリポジトリ ヘッダーのスクリーンショット。 [設定] タブが濃いオレンジ色の枠線で強調表示されています。](/assets/cb-28260/images/help/repository/repo-actions-settings.png)
-
左側のサイド バーの [コードと自動化] の下で、 [ルール] をクリックし、 [ルールセット] をクリックします。
![リポジトリの [設定] ページのサイド バーのスクリーンショット。 [ルール] サブメニューが展開され、[ルールセット] オプションの枠線がオレンジ色で表示されています。](/assets/cb-80504/images/help/repository/rulesets-settings.png)
-
Click New ruleset.
-
To create a ruleset targeting branches, click New branch ruleset.
-
[ルールセット名] に、ルールセットの名前を入力します。
-
必要に応じて、既定の適用状態を変更するには、 [Disabled] をクリックして、新しい適用状態を選びます。
-
[ブランチ保護] で、[Require code scanning results] を選択します。
-
[Required tools and alert thresholds] の [Add tool] をクリックして、ドロップダウンで code scanning ツールを選びます。 たとえば、"CodeQL"。
-
code scanning ツールの名前の隣
- [アラート] をクリックし、[なし]、[エラー]、[エラーと警告]、または [すべて] のいずれかを選択します。
- [セキュリティ アラート] をクリックし、[なし]、[重大]、[高以上]、[中以上]、または [すべて] のいずれかを選択します。
![[ルールセット] 設定の [必要なツールとアラートのしきい値] セクションのスクリーンショット。](/assets/cb-42772/images/help/repository/rulesets-require-code-scanning.png)
アラートの重大度とセキュリティの重大度レベルの詳細については、「Code scanningアラートについて」を参照してください。
For more information about managing rulesets in a repository, see リポジトリのルールセットの管理.
Creating a merge protection ruleset with the REST API
You can use the REST API to create a ruleset with the code_scanning rule, which allows you to define specific tools and set alert thresholds. For more information, see ルールの REST API エンドポイント.