title | shortTitle | intro | product | versions | type | topics | ||||
---|---|---|---|---|---|---|---|---|---|---|
Set code scanning merge protection |
Set merge protection |
You can use rulesets to set {% data variables.product.prodname_code_scanning %} merge protection for pull requests. |
{% data reusables.gated-features.code-scanning %} |
|
how_to |
|
{% note %}
Notes:
- This feature is currently in beta and subject to change.
- Merge protection with rulesets is not related to status checks. For more information about status checks, see "AUTOTITLE."
- Merge protection with rulesets will not apply to merge queue groups or {% data variables.product.prodname_dependabot %} pull requests analyzed by default setup.
{% endnote %}
You can use rulesets to prevent pull requests from being merged when one of the following conditions is met:
{% data reusables.code-scanning.merge-protection-rulesets-conditions %}
For more information about {% data variables.product.prodname_code_scanning %} alerts, see "AUTOTITLE."
You can set merge protection with rulesets at the repository {% ifversion ghec or ghes %}or organization levels{% else %}level{% endif %}, and for repositories configured with either default setup or advanced setup. You can also use the REST API to set merge protection with rulesets.
For more information about rulesets, see "AUTOTITLE."
{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %} {% data reusables.repositories.repo-rulesets-settings %}
- Click New ruleset.
- To create a ruleset targeting branches, click New branch ruleset. {% data reusables.repositories.rulesets-general-step %} {% data reusables.repositories.rulesets-require-code-scanning-results %}
For more information about managing rulesets in a repository, see "AUTOTITLE."
{% ifversion ghec or ghes %}
{% data reusables.profile.access_org %} {% data reusables.profile.org_settings %} {% data reusables.organizations.access-ruleset-settings %}
- Click New ruleset.
- To create a ruleset targeting branches, click New branch ruleset. {% data reusables.repositories.rulesets-general-step %} {% data reusables.repositories.rulesets-require-code-scanning-results %}
For more information about managing rulesets for repositories in an organization, see "AUTOTITLE."
{% endif %}
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 "AUTOTITLE."