3 - Managing a branch protection rule
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 > Branches
settings of your own repository - In the section
Branch protection rules
click 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
- Search for
build
and select it as a required status check (if Activity 2 has not been completed, create a new simple workflow) - Require conversation resolution before merging
- Do not allow bypassing the above settings
- Click
Create
to create the branch protection rule - Test the branch protection by adding/updating one file from your repository
- Commit the changes into a new
feature/lab03
branch - 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