|
| 1 | +# Branch Protection Rules |
| 2 | + |
| 3 | +This document outlines the recommended branch protection rules for the `main` branch. |
| 4 | + |
| 5 | +## Required Status Checks |
| 6 | + |
| 7 | +The following GitHub Actions workflows should pass before merging: |
| 8 | + |
| 9 | +### Critical Checks |
| 10 | +- `lint / lint success` |
| 11 | +- `unit / unit success` |
| 12 | +- `integration / integration success` |
| 13 | +- `e2e / e2e` |
| 14 | +- `lint-actions / actionlint` |
| 15 | + |
| 16 | +### Optional but Recommended |
| 17 | +- `docker / build` (for releases) |
| 18 | + |
| 19 | +## Settings |
| 20 | + |
| 21 | +1. **Require a pull request before merging** |
| 22 | + - Require approvals: 1 |
| 23 | + - Dismiss stale pull request approvals when new commits are pushed |
| 24 | + - Require review from CODEOWNERS |
| 25 | + |
| 26 | +2. **Require status checks to pass before merging** |
| 27 | + - Require branches to be up to date before merging |
| 28 | + - Status checks listed above |
| 29 | + |
| 30 | +3. **Require conversation resolution before merging** |
| 31 | + |
| 32 | +4. **Require signed commits** (optional but recommended) |
| 33 | + |
| 34 | +5. **Include administrators** (optional, depends on team preference) |
| 35 | + |
| 36 | +6. **Restrict who can push to matching branches** |
| 37 | + - Add team/users who can push directly (for emergency fixes) |
| 38 | + |
| 39 | +## Setting Up |
| 40 | + |
| 41 | +To apply these rules: |
| 42 | + |
| 43 | +1. Go to Settings → Branches in your GitHub repository |
| 44 | +2. Add a rule for the `main` branch |
| 45 | +3. Configure the settings as described above |
| 46 | +4. Save changes |
| 47 | + |
| 48 | +## Merge Queue (Optional) |
| 49 | + |
| 50 | +Consider enabling GitHub's merge queue for better handling of multiple PRs: |
| 51 | +- Maximum PRs to merge: 5 |
| 52 | +- Minimum PRs to merge: 1 |
| 53 | +- Wait time: 5 minutes |
0 commit comments