Requiring a successful build for a merge
Let's finish off by making sure that merging a PR requires a successful premerge build. We want to check for possible mistakes and prevent shipping broken functionalities. Protected branches can be used to ensure that the code is thoroughly tested and reviewed:
- Go to the
adder
repository in GitHub | Settings | Branches | Branch protection rules |Add rule. Configure as follows:- Branch name pattern:
main
- Require status check pass before merging: Check
- Status checks that are required:
Jenkins CI
- Branch name pattern:
- Click Create to save.
- Create a new PR to see that it now requires a successful build of Jenkins CI for a merge:
Now our adder
Git repository's main
branch is protected with a validation requirement that is set from automatically triggered...