Skip to content

docs(branch-protection): document --apply mode and admin-token caveat - #417

Merged
joshua-temple merged 1 commit into
mainfrom
docs/branch-protection-apply
Jun 29, 2026
Merged

joshua-temple merged 1 commit into
mainfrom
docs/branch-protection-apply

Conversation

@joshua-temple

Copy link
Copy Markdown
Collaborator

What

Documents the cascade branch-protection --apply mode added in #416, which shipped under-documented.

Changes

  • cli-reference.md: rewrote the branch-protection section to cover both modes (default emit-JSON vs --apply direct PUT), added an apply subsection, and expanded the flags table (--apply, --token, --repo, --branch, --api-url with their env fallbacks). Corrected two sentences that feat(branch-protection): add --apply to apply protection with a scoped token #416 made stale: the intro claim that cascade never calls the GitHub API, and the unconditional note that --branch only labels the guidance.
  • security/hardening.md: a one-line cross-reference on the branch-protection bullet pointing at the apply mode and the admin-token caveat.

Caveat documented

Applying requires a token with repo-admin authority (Administration: write); the workflow GITHUB_TOKEN cannot do it, and the env var is preferred over the flag to keep the token out of process args and shell history.

Verification

Every documented flag and default verified against internal/branchprotection/command.go + apply.go. Default-mode description confirmed behavior-accurate (emit wrapper, no API call when --apply is absent). Docs-only; no Go changes.

branch-protection now has two modes: the unchanged default that emits the protection JSON for an operator to apply, and an opt-in --apply that PUTs the body to GitHub directly with a caller-supplied scoped token. Document the new --apply, --token, --repo, and --api-url flags with their env fallbacks, note that applying requires repo-admin (Administration: write) which the workflow GITHUB_TOKEN lacks, and prefer the env var over the flag to keep the token out of process args. Cross-reference the apply mode from the hardening guide.

Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
@joshua-temple
joshua-temple merged commit fcb27e6 into main Jun 29, 2026
16 checks passed
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.

1 participant