45 / 48 · 16 CI/CD Pipelines · Quality Gates← prev⊞ allnext →☰ Read as one page
7.3Configuring Gates in GitHub
Branch Protection Rules
- Go to Settings > Branches > Branch protection rules
- Add a rule for
main - Enable "Require status checks to pass before merging"
- Select the specific checks that must pass (e.g.,
unit-tests,lint,security-scan) - Enable "Require branches to be up to date before merging" (ensures the PR is tested against the latest main)
- Enable "Require pull request reviews before merging" (human gate)
Required vs Optional Checks
Not every check needs to be required. Use required checks for gates that must never be bypassed, and optional checks for informational feedback.
| Check | Required? | Rationale |
|---|---|---|
| Unit tests | Yes | Broken logic must not reach main |
| Lint / format | Yes | Consistent code style is non-negotiable |
| Integration tests | Yes | API and database issues must be caught |
| Browser tests | Yes (on main) | UI regressions must be caught before deploy |
| Coverage (patch) | Yes | New code must be tested |
| Coverage (overall) | No | Legacy code coverage should improve over time, not block PRs |
| Security scan | Yes (high/critical) | Critical vulnerabilities must not ship |
| Performance budget | No (initially) | Start as informational, promote to required once budgets are stable |