You can automatically enforce protected branch settings for some or all branches in your repository. For more information, see "Configuring protected branches."
Before you can enable required status checks, you must configure the repository to use the status API. For more information, see "Building a CI Server."
- On GitHub Enterprise Server, navigate to the main page of the repository.
- Under your repository name, click Settings.
- In the left menu, click Branches.
- Next to "Branch protection rules", click Add rule.
- Under "Branch name pattern", type the branch name or pattern you want to protect.
- Under "Protect matching branches", select Require status checks to pass before merging.
- Optionally, select Require branches to be up to date before merging. If selected, this ensures that the branch is tested with the latest code on the base branch.
- From the list of available status checks, select the checks you want to require.
- Optionally, select Include administrators. This enforces all configured restrictions for repository administrators.
- Click Create.
Tip: To successfully merge a pull request into a base branch that has required status checks enabled, the pull request's head branch must be up-to-date with the base branch.