Skip to content

Protect v2/main against force-push and deletion #5121

Closed

Description

@cliffhall

Problem

v2/main, the develop branch every PR targets, has no rulesets and no branch protection: gh api repos/modelcontextprotocol/servers/rules/branches/v2/main returns []. Anyone with push access can force-push or delete it, and push to it without a PR.

That also weakens #5119. The Source is v2/main guard on main accepts a PR whose head is an ancestor of origin/v2/main, so it trusts v2/main's history. Rewriting v2/main could make a legitimate milestone merge fail the guard, and pushing an unreviewed commit straight onto v2/main would let it through.

Found while building #5119 (PR #5120).

Proposal

A repo ruleset for refs/heads/v2/main: block deletion and non-fast-forward pushes, and require a pull request. Decide the bypass list deliberately: the changesets "Version Packages" action and the Prepare Python Release workflow push branches and open PRs, but do they push to v2/main itself? Check before requiring PRs, so neither breaks.

Expected

A force-push or deletion of v2/main is refused, and changes reach it only through PRs.

Activity

  1. added this to the v2.0.0 milestone on Oct 11, 2026
  2. added
    chore
    on Oct 11, 2026
  3. self-assigned this
    on Oct 13, 2026
  4. cliffhall commented on Oct 13, 2026

    @cliffhall
    MemberAuthor

    Shipped in #5140 (merged as 0a861a9). The v2/main: PRs only ruleset is active on v2/main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

chorev2

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions