Packs / github-ops-public
branch-protection
Protect main: require PRs + 1 review + status checks, block force-push and deletion via the REST API; what to do when the free plan returns 403 on private repos (CODEOWNERS, rulesets on paid plans).
Install
logicpacks pack use github-ops-public/branch-protectionget_pack github-ops-public/branch-protectionThe second line is the MCP tool call for the LogicPacks connector (Claude Code, Codex, Claude.ai and others). The first run of a pack someone else wrote asks for your yes.
Keys it needs (names only)
- GITHUB_TOKEN
Playbooks included
- Spec:
spec/SPEC.md(goal, steps, edge cases, don’ts) - Routes:
gh-cli - Checks: 2 in
outcome/checks.yaml - Code:
protect.sh - Tools: gh
Usage, last 8 weeks
New: no recorded use yet.
Purpose (from spec/SPEC.md)
Protect main: require PRs + 1 review + status checks, block force-push and deletion via the REST API; what to do when the free plan returns 403 on private repos (CODEOWNERS, rulesets on paid plans).
Goal
Nobody (agents included) can push straight to main or force-push over history.
Steps
- Read current state (read-only):
gh api repos/<o>/<r>/branches/main/protection(404 = unprotected, 403 = plan doesn't allow). - Apply:
bash code/protect.sh <o> <r> main(PR required, 1 approval, dismiss stale reviews, no force-push/deletion, linear history). - Add
.github/CODEOWNERSso the owner is requested on every PR. - On 403 (free plan + private repo): decide upgrade vs trust + CODEOWNERS; record the decision.
Edge cases
- Admins can bypass unless enforce_admins is true; agents often run as admin.
- Required status checks must match job names exactly.