AIToday
AI Coding AssistantsAI Safety & AlignmentZenn AI/MLPublished: Dec 5, 2026, 22:01 JST

Free-plan repo, no branch protection: 3-layer guard for AI auto-merge

Send on LINE
Free-plan repo, no branch protection: 3-layer guard for AI auto-merge

3 Key Points

  1. What happened

    With branch protection (a GitHub rule blocking merges to protected branches) unavailable on a free-plan private repo, the developer layered three guards: five CI checks run from main-branch scripts, a fine-grained token without Workflows permission, and a single merge-check.sh script that gates merges on seven conditions. The foundation PR still drew 8, 4, and 3 major findings over three review rounds and did not close within three rounds.

  2. Why it matters

    A check script rewritten inside a PR could pass CI, so pointing workflows at main-branch scripts closed that hole; the token blocks pushes to .github/workflows/ but, with full personal gh auth on the same Mac, is only an accident-prevention layer, the author notes.

Ask AI

Ask the AI about this article. Questions and answers are published on this page

Context & Analysis

The experiment's starting constraint was economic: rather than pay to unlock branch protection, the author kept the free plan and rebuilt the missing guardrail from other GitHub features. The three layers are not equivalent in strength — the token layer is explicitly described as accident prevention rather than enforcement, because full-permission gh authentication remains on the same Mac — but together they let the agent run an eight-times-a-day schedule from 8:00 to 22:00 without a human in the loop for routine merges.

The most instructive failure came from the review process itself. Treating every PR as guilty until proven otherwise (adversarial review) meant the foundation PR kept revealing new ways to bypass the same boundary: 8, then 4, then 3 major findings, so the three-round cap stopped auto-merge and the author merged manually by commit SHA, fixing the remaining three items in a separate PR. The merge gate was later reduced to one shell script returning exit code 0 only when seven conditions hold, after a typo in a manual command once let a merge proceed with no output.

Measured results stayed modest: by midday of day two, 14 PRs, 12 merges, and 9 auto-merges against 3 human-judged ones. Later the flow reached a 34th PR, and the five-per-day auto-merge cap was lifted for about an hour when it was hit early. The author's conclusion is that code writing and passing checks can largely be delegated once guards are stacked, while constraint design, spec taste, and publish decisions remain faster and more reliable in human hands.

FAQ
Why couldn't the developer just use branch protection?
On GitHub's free plan, branch protection is unavailable for private repositories and the API returned 403, so the experiment proceeded without it rather than paying.
What did the safety layers actually block?
The fine-grained token returned 404 for another private repo and refused pushes of workflow files, while normal code pushes succeeded; CI checks were fixed to run from main-branch scripts after a PR could otherwise rewrite them.
How much was still left to a human?
By midday of day two, 19 items required human decisions, including whether to pay for branch protection, visual and spec choices, and the final call on publishing.
Send on LINE

AI news that matters for your work, delivered every morning.

Pick your industry and the AI tools you use, and get news related to your work every day.

By signing up you agree to the Terms of Service and Privacy Policy.

Free · 30 seconds with Google · unsubscribe anytimeWhat is AIToday? →

Related Articles

Next articlePlaud Note Pro Flow Edition gets 20% off in first Black Friday sale