Repository navigation
ci: require a code owner's approval to merge to main - #5
Merged
Merged
Conversation
Merging a change to the image publishes it within minutes, and every fctl host pulls it. main's ruleset asked for pull requests but no approval, so an agent in an fctl session could merge its own change into the image every session runs in. Now (hyperstructure/fctl's ADR 0021): - .github/rulesets/main.json is main's ruleset as it should be applied: as before, squash-merged pull requests with passing checks, no force pushes or deletion; now also a code owner's approval from someone who did not push the last commit, stale approvals dismissed, linear history, and organization owners may bypass it on pull requests only. - .github/CODEOWNERS: kalaspuff. fctl-sh[bot] cannot be a code owner. Refs hyperstructure/fctl#22
kalaspuff
pushed a commit
to hyperstructure/fctl
that referenced
this pull request
Oct 18, 2026
Branch protection for `main` and the release tags, done so that agents can't get around it. The design is in ADR 0021. ## What changes - **`.github/rulesets/main.json`**, the ruleset to apply to `main`: - squash-merged pull requests only, linear history, no force pushes or deletion; - passing `cargo xtask check`, `cargo xtask dev --smoke` and `Conventional Commits` (from GitHub Actions); - a code owner's approval, from someone who didn't push the last commit. - Deploy keys bypass it. Organization owners bypass it on pull requests only. - **`.github/rulesets/release-tags.json`**: only deploy keys create, move or delete `v*` tags. - **`.github/CODEOWNERS`**: `@kalaspuff`. Agents act as fctl-sh[bot], which can't be a code owner, so they can't approve their own changes or anyone else's. - **Release workflow:** `prepare` runs in `production` and checks out over SSH with `RELEASE_DEPLOY_KEY`, so its push of the release commit and tag gets past the rulesets. - That push starts CI, which redeploys app.fctl.sh, so `Publish` no longer dispatches CI and no longer needs `actions: write`. - Every run, a dry run too, now starts from `main`, which is what the release skill already says. - **Docs:** AGENTS.md, the commit and release skills, `docs/development.md` and ADR 0021 (with its row in the ADR index). ## Why not #22 as written - **GitHub Actions on the bypass list:** any workflow could then push to `main`, including one an agent writes on a branch. Agent tokens have `workflows: write`. - **No required approval:** an agent could merge its own pull request. Either way, code would reach `main`, and `main` deploys with the production secrets. Requiring a code owner, not just any approval, also stops an approval from fctl-sh[bot] counting on a pull request someone else pushed to last. ## Order 1. An admin adds the release deploy key and puts `RELEASE_DEPLOY_KEY` into `production`. 2. Merge this. Before the key exists, the checkout falls back to the token, which still works while there's no ruleset. 3. Apply the rulesets from these files. ADR 0021 replaces ADR 0006's note that `main` is protected only by convention. ADRs are never rewritten, so 0006 stays as it is. ## Verified - actionlint 1.7.12 passes. - `cargo test -p xtask` passes; it reads `release.yml`. - The ruleset JSON parses. The fields follow GitHub's REST reference for repository rulesets. - The push with the deploy key gets its first real test at the next release. If it fails, the push is atomic, so nothing is half-released. Refs #22. Session: https://app.fctl.sh/s/ses_01M58A7MAFDWKZDCA239GR6H6G ## Related pull requests - #97: fctl's rulesets, the Release workflow's deploy key, ADR 0021 - hyperstructure/design#13: design's rulesets and Release workflow - hyperstructure/fctl-site#19: fctl-site's ruleset - hyperstructure/sandbox#5: sandbox's ruleset, now with a required approval Co-authored-by: fctl-sh[bot] <fctl-sh[bot]@users.noreply.github.com>
kalaspuff
pushed a commit
to hyperstructure/design
that referenced
this pull request
Oct 18, 2026
The same rules as hyperstructure/fctl#97 (its ADR 0021 has the reasoning). ## What changes - **`.github/rulesets/main.json`**, the ruleset to apply to `main`: - squash-merged pull requests only, linear history, no force pushes or deletion; - passing `check` and `Conventional Commits`; - a code owner's approval, from someone who didn't push the last commit. - Deploy keys bypass it. Organization owners bypass it on pull requests only. - **`.github/rulesets/release-tags.json`**: only deploy keys create, move or delete `v*` tags. fctl's web app and fctl.sh pin these tags. - **`.github/CODEOWNERS`**: `@kalaspuff`. - **Release workflow:** the job runs in `production` and checks out over SSH with `RELEASE_DEPLOY_KEY`, so its push gets past the rulesets. Every run, a dry run too, starts from `main`. - Unlike a `GITHUB_TOKEN` push, that push starts workflows. CI checks the tag, which it never did before, and the Release workflow runs again and finds nothing due. - **Docs:** AGENTS.md and the commit and release skills. ## Order 1. An admin creates the `production` environment (`main` only), adds the release deploy key and sets `RELEASE_DEPLOY_KEY`. 2. Merge this. Its own Release run then checks out with the key. 3. Apply the rulesets from these files. ## Verified - `npm run check` passes. Biome formatted the JSON. - `npm test` and `npm run build` pass. - actionlint passes. Refs hyperstructure/fctl#22. Session: https://app.fctl.sh/s/ses_01M58A7MAFDWKZDCA239GR6H6G ## Related pull requests - hyperstructure/fctl#97: fctl's rulesets, the Release workflow's deploy key, ADR 0021 - #13: design's rulesets and Release workflow - hyperstructure/fctl-site#19: fctl-site's ruleset - hyperstructure/sandbox#5: sandbox's ruleset, now with a required approval Co-authored-by: fctl-sh[bot] <fctl-sh[bot]@users.noreply.github.com>
kalaspuff
pushed a commit
to hyperstructure/fctl-site
that referenced
this pull request
Oct 18, 2026
The same rules as hyperstructure/fctl#97 (its ADR 0021 has the reasoning). `main` deploys fctl.sh, including `/install`, which people pipe to `sh`. ## What changes - **`.github/rulesets/main.json`**, the ruleset to apply to `main`: - squash-merged pull requests only, linear history, no force pushes or deletion; - passing `build` and `Conventional Commits`; - a code owner's approval, from someone who didn't push the last commit. - Deploy keys bypass it, so fctl's CI can still pin `fctl-docs.ref` with `SITE_DEPLOY_KEY`. Organization owners bypass it on pull requests only. - **`.github/CODEOWNERS`**: `@kalaspuff`. - **Docs:** AGENTS.md and the commit skill. No workflow change: nothing here pushes to `main` except fctl's docs pin. ## Verified - `npm run check` passes. Its two warnings, in 404.html and 500.html, are already on `main`. - `npm test` and `npm run build` pass. The build fetches fctl's docs without signing in. Refs hyperstructure/fctl#22. Session: https://app.fctl.sh/s/ses_01M58A7MAFDWKZDCA239GR6H6G ## Related pull requests - hyperstructure/fctl#97: fctl's rulesets, the Release workflow's deploy key, ADR 0021 - hyperstructure/design#13: design's rulesets and Release workflow - #19: fctl-site's ruleset - hyperstructure/sandbox#5: sandbox's ruleset, now with a required approval Co-authored-by: fctl-sh[bot] <fctl-sh[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merging a change to the image publishes it within minutes, and every fctl host pulls it.
main's ruleset required a pull request but no approval, so an agent in an fctl session could merge its own change into the image every session runs in. These are the same rules as hyperstructure/fctl#97 (its ADR 0021 has the reasoning).What changes
.github/rulesets/main.json:main's ruleset as it should be applied.Conventional CommitsandShellCheck and actionlintpassing, no force pushes or deletion, and the existingrequire_extra_approval_for_unattributed_changes..github/CODEOWNERS:@kalaspuff.The ruleset already exists (id 25341995), so an admin updates it with
PUTfrom this file rather than creating a new one.Refs hyperstructure/fctl#22.
Session: https://app.fctl.sh/s/ses_01M58A7MAFDWKZDCA239GR6H6G
Related pull requests