Skip to content

Comments

Secure main branch: require PRs with owner approval, block direct pushes#25

Merged
leeoades merged 2 commits intomainfrom
copilot/secure-main-branch-settings
Feb 19, 2026
Merged

Secure main branch: require PRs with owner approval, block direct pushes#25
leeoades merged 2 commits intomainfrom
copilot/secure-main-branch-settings

Conversation

Copy link
Contributor

Copilot AI commented Feb 19, 2026

Direct pushes to main are currently unrestricted. This adds branch protection enforced via GitHub API and code ownership to require all changes go through an approved PR.

Changes

.github/CODEOWNERS

  • Designates @leeoades as required reviewer for all files — every PR requires their explicit approval before merge

.github/workflows/branch-protection.yml

  • Applies branch protection rules to main via actions/github-script using the built-in GITHUB_TOKEN (administration: write)
  • Runs on workflow_dispatch (trigger manually after merge) and on changes to the workflow file itself

Rules enforced on main:

Direct / force pushes Blocked
Branch deletion Blocked
Required approvals 1 (code-owner review)
Stale review dismissal Enabled
Enforce for admins Yes

Feature branches are unaffected — force-push and delete remain unrestricted elsewhere.

After merging, run Actions → Apply Branch Protection → Run workflow to activate the rules immediately.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…anch

Co-authored-by: leeoades <2321091+leeoades@users.noreply.github.com>
Copilot AI changed the title [WIP] Update branch protection rules for main branch Secure main branch: require PRs with owner approval, block direct pushes Feb 19, 2026
Copilot AI requested a review from leeoades February 19, 2026 21:55
@leeoades leeoades marked this pull request as ready for review February 19, 2026 21:56
@leeoades leeoades merged commit 4a0fd75 into main Feb 19, 2026
@leeoades leeoades deleted the copilot/secure-main-branch-settings branch February 19, 2026 21:56
leeoades added a commit that referenced this pull request Feb 20, 2026
…ch-settings"

This reverts commit 4a0fd75, reversing
changes made to 4a1cab8.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants