3 - Repository Branch Protection Rules
In this lab you will create a branch protection rule to enforce certain workflows for one or more branches
Duration: 5-10 minutes
References:
3.1 Add a branch protection rule
- Navigate to the
Settings > Branchessettings of your own repository - In the section
Branch protection rulesclick onAdd rule - Type
main*(master*) for branch name pattern - Check at least the following settings:
- Require a pull request before merging
- Require review from Code Owners
- Require status checks to pass before merging
- Require conversation resolution before merging
- Include administrators
- Click
Createto create the branch protection rule - Test the branch protection by adding/updating one file from your repository
- Commit the changes into a new
feature/lab03branch - Open a new pull request from
Pull requests - Ask the code owner to review and approve your PR
- (Optional) Update the CODEOWNERS file to add more members or a team as code reviewers