Skip to main content

Branch Protection Configuration

Overview

Guidelines and configuration for GitHub branch protection rules in hve-core.

Branch protection rules ensure code quality and security by requiring:

  • Status checks to pass before merging
  • Code review approval
  • Protection against post-approval malicious commits

Required Status Checks

The following CI jobs must pass before a PR can be merged:

Check NamePurpose
Spell CheckValidates spelling in markdown
Markdown LintEnforces markdown formatting
Table Format CheckValidates table formatting
PowerShell LintPSScriptAnalyzer validation
Frontmatter ValidationValidates YAML frontmatter
Validate Dependency PinningEnsures dependencies are pinned
npm Security AuditScans for vulnerable dependencies
CodeQL Security AnalysisSecurity vulnerability scanning

Note: Markdown Link Check uses soft-fail and is not a required check.

Review Requirements

SettingValueRationale
Required reviewers1Team size decision
Dismiss stale reviewsEnabledPrevents post-approval malicious commits
Last push approvalEnabledRequires non-author approval of final changes
Code owner reviewEnabledEnsures domain experts review changes

CODEOWNERS

The .github/CODEOWNERS file defines code ownership:

  • Default owner for all files: @microsoft/edge-ai-core-dev
  • Self-protection pattern prevents unauthorized CODEOWNERS modifications
  • Key directories have explicit ownership

OpenSSF Scorecard

With this configuration, the expected OpenSSF Scorecard Branch Protection score is ~8/10.

Note: Achieving 10/10 requires 2 reviewers. The current configuration prioritizes team velocity with 1 reviewer.

Configuration Reference

GitHub UI Settings

Navigate to: Settings → Branches → Branch protection rules → Edit main

Require a Pull Request before Merging

  • Require approvals (1)
  • Dismiss stale pull request approvals when new commits are pushed
  • Require approval of the most recent reviewable push
  • Require review from Code Owners

Require Status Checks to Pass before Merging

  • Require branches to be up to date before merging
  • Add all status checks listed in table above

Other Settings

  • Do not allow bypassing the above settings

Future Considerations

ItemDetails
GitHub RulesetsConsider migrating to Rulesets for enhanced push restrictions
2 reviewersCan be enabled as team grows for Tier 4 (9/10) score

🤖 Crafted with precision by ✨Copilot following brilliant human instruction, then carefully refined by our team of discerning human reviewers.