Skip to content

Gate main on one ci-passed check, and script its protection - #2

Merged
ftymoshchuk merged 1 commit into
mainfrom
claude/affectionate-dirac-bdukrw
Oct 16, 2026
Merged

ftymoshchuk merged 1 commit into
mainfrom
claude/affectionate-dirac-bdukrw

Conversation

@ftymoshchuk

Copy link
Copy Markdown
Owner

Gets Pasteup ready for the same branch protection as the sigrix-io public repositories, before it goes public.

What changed

  • ci-passed check. This CI job is copied from sigrix-io/mullion. It runs after the test matrix whatever the outcome, and fails if any part of it failed or was cancelled. It's the one check main requires, so changing the matrix never means editing the ruleset.
  • scripts/protect-repo.sh applies the protection with gh api. It's safe to re-run, because it updates the existing ruleset instead of creating another.
    • Ruleset: sigrix-io/mullion's default-branch ruleset.
      • main cannot be deleted or force-pushed.
      • Changes land only through pull requests, with no approval required.
      • A merge needs ci-passed green from GitHub Actions and the branch up to date with main.
    • Merge settings: the same as mullion's. They differ from GitHub's defaults only in deleting branches after merge.
    • Security features: Dependabot alerts now. Once the repo is public, also private vulnerability reporting (which SECURITY.md points to), secret scanning and push protection.

Differences from the sigrix ruleset

  • Bypass. The sigrix ruleset lets one sigrix team bypass it, and a personal repo has no teams. Repository admins take that team's place, with the same limit: bypass only through a pull request, never a direct push.
  • Omitted parameters. Review settings that sigrix leaves at their defaults are left out instead of repeated. The effect is the same.

Order of operations

  1. Merge this PR, so ci-passed exists before anything requires it.
  2. Run scripts/protect-repo.sh.
    • On GitHub Free, a private repo can't have rulesets. The script reports this, applies everything else, and exits with code 2.
    • In that case, make the repo public and run the script again straight away. Going public gives nobody push access, so nothing is exposed in between.
  3. On the run after going public, the script also enables the security features that exist only for public repos.

Testing

  • actionlint passes on the workflow, and shellcheck and bash -n pass on the script.
  • I couldn't run the script against GitHub, because Claude's GitHub app has no admin rights. Instead I ran it against a fake gh that serves canned API responses and runs the script's own --jq filters. Scenarios covered:
    • a private repo on Free, refused at creation, and again refused at listing
    • a private repo on a paid plan
    • a re-run after going public, which updated the existing ruleset in place and ignored same-named rulesets from other sources
    • a validation error
    • no access to the repo
  • The ruleset the script sends equals mullion's except for the two documented differences, checked by comparing JSON.
  • This PR's own CI run is where ci-passed reports for the first time.

🤖 Generated with Claude Code

https://claude.ai/code/session_01E6aBDEnU4vqKQ4F9cnJMrL


Generated by Claude Code

Pasteup is to carry the same branch ruleset as the sigrix-io public
repositories, which requires a single aggregate check, `ci-passed`, rather
than each job by name. The workflow gains that job, copied from
sigrix-io/mullion: it runs after the test matrix whatever the outcome and
fails if any leg failed or was cancelled, so changing the matrix never means
editing the ruleset.

scripts/protect-repo.sh applies, through `gh api`:

- sigrix-io/mullion's "default-branch" ruleset: no deletion or force-push of
  the default branch; changes only through pull requests, with no approval
  required; merging needs `ci-passed` green from GitHub Actions and the branch
  up to date. Its bypass actor, a sigrix team, becomes repository admins in
  the same pull-request-only mode, since a personal repository has no teams.
- The same merge settings as mullion, which differ from the defaults only by
  deleting branches once merged.
- Dependabot alerts, and once the repository is public, private
  vulnerability reporting (which SECURITY.md points to), secret scanning and
  push protection.

It is safe to re-run: the ruleset is updated in place. On GitHub Free a
private repository cannot have rulesets, and the script says so and asks to be
run again right after the repository goes public.

Tested against a fake `gh` that serves canned API responses and runs the
script's own jq filters: a private repository on Free (refused at creation
and at listing), on a paid plan, a re-run after going public, a validation
error, and no access. The ruleset sent equals mullion's except for the
documented bypass change and the omitted default-valued review parameters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E6aBDEnU4vqKQ4F9cnJMrL
@ftymoshchuk
ftymoshchuk merged commit ce7dbcd into main Oct 16, 2026
3 checks passed
@ftymoshchuk
ftymoshchuk deleted the claude/affectionate-dirac-bdukrw branch October 16, 2026 12:25
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