Branch Protection Rules
Last updated
Was this helpful?
This project uses GitHub Branch Protection Rules to ensure code quality and prevent breaking changes from being merged to the main branch.
Navigate to your GitHub repository
Go to Settings > Branches
Under Branch protection rules, click Add rule
Configure the following settings:
Branch name pattern: main
Check "Require a pull request before merging"
Check "Require approvals" and set it to at least 1
Check "Require status checks to pass before merging"
Check "Require branches to be up to date before merging"
In the status checks search box, select all the CI checks:
Static Analysis
Build
Test
Check "Include administrators" to ensure everyone follows the same rules
Check "Restrict who can push to matching branches" and add appropriate teams/users
Check "Allow force pushes" and select "Specify who can force push" for administrators only
With these rules in place:
Direct pushes to the main branch are prevented
All changes must go through pull requests
Pull requests require at least one approval
All CI checks must pass before merging
Branches must be up-to-date with the base branch before merging
This ensures that:
Code is reviewed
Tests pass
Static analysis is successful
The codebase maintains high quality standards
Last updated
Was this helpful?
Was this helpful?