microsoft/hve-core
Publicmirrored fromhttps://github.com/microsoft/hve-coreAvailable
docs/contributing/branch-protection.md
99lines · modecode
| 1 | --- |
| 2 | title: Branch Protection Configuration |
| 3 | description: Branch protection configuration for the hve-core repository |
| 4 | author: Microsoft |
| 5 | ms.date: 2026-01-16 |
| 6 | ms.topic: reference |
| 7 | keywords: |
| 8 | - branch protection |
| 9 | - security |
| 10 | - openssf scorecard |
| 11 | - codeowners |
| 12 | estimated_reading_time: 3 |
| 13 | --- |
| 14 | |
| 15 | ## Overview |
| 16 | |
| 17 | Guidelines and configuration for GitHub branch protection rules in hve-core. |
| 18 | |
| 19 | Branch protection rules ensure code quality and security by requiring: |
| 20 | |
| 21 | * Status checks to pass before merging |
| 22 | * Code review approval |
| 23 | * Protection against post-approval malicious commits |
| 24 | |
| 25 | ## Required Status Checks |
| 26 | |
| 27 | The following CI jobs must pass before a PR can be merged: |
| 28 | |
| 29 | | Check Name | Purpose | |
| 30 | |-----------------------------|-----------------------------------| |
| 31 | | Spell Check | Validates spelling in markdown | |
| 32 | | Markdown Lint | Enforces markdown formatting | |
| 33 | | Table Format Check | Validates table formatting | |
| 34 | | PowerShell Lint | PSScriptAnalyzer validation | |
| 35 | | Frontmatter Validation | Validates YAML frontmatter | |
| 36 | | Validate Dependency Pinning | Ensures dependencies are pinned | |
| 37 | | npm Security Audit | Scans for vulnerable dependencies | |
| 38 | | CodeQL Security Analysis | Security vulnerability scanning | |
| 39 | |
| 40 | **Note**: `Markdown Link Check` uses soft-fail and is not a required check. |
| 41 | |
| 42 | ## Review Requirements |
| 43 | |
| 44 | | Setting | Value | Rationale | |
| 45 | |-----------------------|---------|-----------------------------------------------| |
| 46 | | Required reviewers | 1 | Team size decision | |
| 47 | | Dismiss stale reviews | Enabled | Prevents post-approval malicious commits | |
| 48 | | Last push approval | Enabled | Requires non-author approval of final changes | |
| 49 | | Code owner review | Enabled | Ensures domain experts review changes | |
| 50 | |
| 51 | ## CODEOWNERS |
| 52 | |
| 53 | The `.github/CODEOWNERS` file defines code ownership: |
| 54 | |
| 55 | * Default owner for all files: `@microsoft/edge-ai-core-dev` |
| 56 | * Self-protection pattern prevents unauthorized CODEOWNERS modifications |
| 57 | * Key directories have explicit ownership |
| 58 | |
| 59 | ## OpenSSF Scorecard |
| 60 | |
| 61 | With this configuration, the expected OpenSSF Scorecard Branch Protection score is **~8/10**. |
| 62 | |
| 63 | **Note**: Achieving 10/10 requires 2 reviewers. The current configuration prioritizes team velocity with 1 reviewer. |
| 64 | |
| 65 | ## Configuration Reference |
| 66 | |
| 67 | ### GitHub UI Settings |
| 68 | |
| 69 | Navigate to: **Settings → Branches → Branch protection rules → Edit `main`** |
| 70 | |
| 71 | **Require a pull request before merging**: |
| 72 | |
| 73 | * [x] Require approvals (1) |
| 74 | * [x] Dismiss stale pull request approvals when new commits are pushed |
| 75 | * [x] Require approval of the most recent reviewable push |
| 76 | * [x] Require review from Code Owners |
| 77 | |
| 78 | **Require status checks to pass before merging**: |
| 79 | |
| 80 | * [x] Require branches to be up to date before merging |
| 81 | * Add all status checks listed in table above |
| 82 | |
| 83 | **Other settings**: |
| 84 | |
| 85 | * [x] Do not allow bypassing the above settings |
| 86 | |
| 87 | ## Future Considerations |
| 88 | |
| 89 | | Item | Details | |
| 90 | |-----------------|---------------------------------------------------------------| |
| 91 | | GitHub Rulesets | Consider migrating to Rulesets for enhanced push restrictions | |
| 92 | | 2 reviewers | Can be enabled as team grows for Tier 4 (9/10) score | |
| 93 | |
| 94 | --- |
| 95 | |
| 96 | <!-- markdownlint-disable MD036 --> |
| 97 | *🤖 Crafted with precision by ✨Copilot following brilliant human instruction, |
| 98 | then carefully refined by our team of discerning human reviewers.* |
| 99 | <!-- markdownlint-enable MD036 --> |