diff --git a/assets/images/help/repository/require-successful-deployment.png b/assets/images/help/repository/require-successful-deployment.png new file mode 100644 index 000000000000..2925f32d5eab Binary files /dev/null and b/assets/images/help/repository/require-successful-deployment.png differ diff --git a/content/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/about-protected-branches.md b/content/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/about-protected-branches.md index ec601bb91be2..c8625b48888c 100644 --- a/content/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/about-protected-branches.md +++ b/content/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/about-protected-branches.md @@ -49,6 +49,9 @@ For each branch protection rule, you can choose to enable or disable the followi {% ifversion fpt or ghec %} - [Require merge queue](#require-merge-queue) {% endif %} +{%- if required-deployments %} +- [Require deployments to succeed before merging](#require-deployments-to-succeed-before-merging) +{%- endif %} - [Include administrators](#include-administrators) - [Restrict who can push to matching branches](#restrict-who-can-push-to-matching-branches) - [Allow force pushes](#allow-force-pushes) @@ -143,6 +146,11 @@ Before you can require a linear commit history, your repository must allow squas {% data reusables.pull_requests.merge-queue-references %} {% endif %} + +### Require deployments to succeed before merging + +You can require that changes are successfully deployed to specific environments before a branch can be merged. For example, you can use this rule to ensure that changes are successfully deployed to a staging environment before the changes merge to your default branch. + ### Include administrators By default, protected branch rules do not apply to people with admin permissions to a repository. You can enable this setting to include administrators in your protected branch rules. diff --git a/content/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/managing-a-branch-protection-rule.md b/content/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/managing-a-branch-protection-rule.md index 8770d005edf6..3a6acd3c4a09 100644 --- a/content/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/managing-a-branch-protection-rule.md +++ b/content/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/managing-a-branch-protection-rule.md @@ -97,6 +97,10 @@ When you create a branch rule, the branch you specify doesn't have to exist yet {% endtip %} {%- endif %} +{%- if required-deployments %} +1. Optionally, to choose which environments the changes must be successfully deployed to before merging, select **Require deployments to succeed before merging**, then select the environments. + ![Require successful deployment option](/assets/images/help/repository/require-successful-deployment.png) +{%- endif %} 1. Optionally, select **Apply the rules above to administrators**. ![Apply the rules above to administrators checkbox](/assets/images/help/repository/include-admins-protected-branches.png) 1. Optionally,{% ifversion fpt or ghec %} if your repository is owned by an organization using {% data variables.product.prodname_team %} or {% data variables.product.prodname_ghe_cloud %},{% endif %} enable branch restrictions. diff --git a/data/features/required-deployments.yml b/data/features/required-deployments.yml new file mode 100644 index 000000000000..c1b7fc94d184 --- /dev/null +++ b/data/features/required-deployments.yml @@ -0,0 +1,7 @@ +# Issue 6384 +# Required deployments branch protection rule +versions: + fpt: '*' + ghec: '*' + ghes: '>=3.5' + ghae: 'issue-6384'