Skip to content

feat(branch-protection): require Docs / build check on jackin main#10

Merged
donbeave merged 1 commit into
mainfrom
feat/required-status-checks-jackin-docs
Apr 25, 2026
Merged

feat(branch-protection): require Docs / build check on jackin main#10
donbeave merged 1 commit into
mainfrom
feat/required-status-checks-jackin-docs

Conversation

@donbeave

@donbeave donbeave commented Apr 25, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds a per-repo required-status-checks rule to the protect-main ruleset.
  • Requires Docs / build (the docs workflow's PR-running job) to pass before a PR can merge into main of the jackin repo.

Why

The existing ruleset (branch-protection.tf) enforced PR-only merges, forbade non-fast-forward, and forbade deletion — but did not require any status check to pass. That left the docs link-check advisory: a red Docs / build could still be merged. The goal of jackin-project/jackin#173 is "no PR breaks any links", and that goal only becomes real when the docs check is required at the protection layer.

Scope

Intentionally docs-only for this PR — Docs / build is the only context being required, because that's the workflow that just landed in #173 and the goal here is to make its enforcement real. CI / check (Rust clippy/fmt/nextest, runs on every PR) is the obvious next candidate and a likely follow-up; it is deliberately not in this PR so the change is one rule, one repo, one revert if needed.

Design

  • New variable repo_required_status_checks is a map(list(string)) keyed by repository name. Repos absent from the map have no required checks (status quo). Currently only jackin = ["Docs / build"].
  • Rationale for per-repo map vs. one shared list: required contexts differ by repo. A Rust repo needs CI / check; homebrew-tap has no CI to require. Forcing one shared list would either block merges on repos that don't emit the expected check or under-protect repos that need different gates.
  • strict_required_status_checks_policy is left at default false. The check must have passed on the head commit; PR authors are not forced to rebase onto the latest main before each merge.
  • integration_id is left unpinned. For a single-org repo with no third-party check publishers installed, the spoofing risk (a different GitHub App publishing a Docs / build check) is essentially zero, and pinning would couple the rule to the GitHub Actions app id and break if that ever changes.

Apply plan

This repo's state is local-only per AGENTS.md ("terraform.tfstate is local-only. It stays on your machine."), so tofu apply runs on the operator's machine, not in CI.

  1. Pull this branch on your machine.
  2. tofu plan against your local state — expect a single change to github_repository_ruleset.protect_main["jackin"] adding the required_status_checks rule.
  3. tofu apply if the plan looks right.
  4. Verify: gh api repos/jackin-project/jackin/rulesets/14746904 --jq '.rules[] | select(.type=="required_status_checks")' should now return the rule with context Docs / build.
  5. Open a throwaway docs PR within five minutes of apply to confirm Docs / build resolves. If it sits in Expected — Waiting for status to be reported, the context format is wrong and needs to switch to bare build.
  6. Coordinate with open Renovate PR #172 (jackin) — it pre-dates docs.yml on main and has no build check; rebase or push to retrigger workflows so it can merge.

Test plan

  • tofu fmt -check clean (verified locally)
  • tofu validate clean (verified locally)
  • tofu plan shows only the expected required_status_checks rule addition on jackin
  • After apply, opening a PR against jackin with a failing Docs / build cannot be merged.

🤖 Generated with Claude Code

The protect-main ruleset enforced PR-only merges and forbade fast-forward
and deletion, but it did not require any status check to pass before a
merge. That left the docs link-check workflow advisory only — a red
Docs / build run could still be merged into main.

Add a per-repo required_status_checks rule keyed off a new
repo_required_status_checks variable. The map starts with jackin
requiring "Docs / build" (the docs workflow's PR-running job that
validates internal links, RepoFile references, and edit links against
the PR checkout). Other repos in protected_repositories remain unchanged
because they have no docs workflow today.

Why a per-repo map instead of a single shared list: the contexts that
must pass differ by repo (a Rust repo needs CI / check; the marketplace
needs its own validation; homebrew-tap has none). Sharing one list would
either over-require contexts that do not exist on some repos (blocking
all merges there forever) or under-require them on the repos that need
the gate.

strict_required_status_checks_policy is left at the default false. PR
authors are not forced to rebase onto the latest main before each merge;
the check just needs to have passed on the head commit.

Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Alexey Zhokhov <alexey@zhokhov.com>
@sonarqubecloud

Copy link
Copy Markdown

@donbeave donbeave merged commit 1c1bf36 into main Apr 25, 2026
2 checks passed
@donbeave donbeave deleted the feat/required-status-checks-jackin-docs branch April 25, 2026 21:17
donbeave added a commit that referenced this pull request Apr 25, 2026
…ly (#11)

Fix the required-status-checks context I introduced in #10. The
context "Docs / build" was the workflow / job display name that
appears in the GitHub PR UI, but GitHub matches against the bare
check-run name, which for the Docs workflow is "build". Result:
zero check-runs ever satisfied the rule, every PR's
mergeStateStatus turned BLOCKED right after #10 applied (see
jackin-project/jackin#180 — green build but blocked merge).

Switch the map to a transitional dual-context list:

- "build" — the current docs link-check job name. Restores merges
  immediately after this applies.
- "docs-link-check" — the unique name the docs job will rename to in
  jackin-project/jackin (PR to follow). Listing it here ahead of the
  rename keeps PRs unblocked across the rename window.

Once the rename PR merges in jackin, drop "build" from this list in
a follow-up apply so we don't have an extra context that could be
silently satisfied by a future unrelated workflow's "build" job.

Verified locally:
- `tofu fmt -check` clean
- `tofu validate` clean
- Pre-commit secret scan clean

Signed-off-by: Alexey Zhokhov <alexey@zhokhov.com>
Co-authored-by: Claude <noreply@anthropic.com>
donbeave added a commit that referenced this pull request May 7, 2026
The protect-main ruleset enforced PR-only merges and forbade fast-forward
and deletion, but it did not require any status check to pass before a
merge. That left the docs link-check workflow advisory only — a red
Docs / build run could still be merged into main.

Add a per-repo required_status_checks rule keyed off a new
repo_required_status_checks variable. The map starts with jackin
requiring "Docs / build" (the docs workflow's PR-running job that
validates internal links, RepoFile references, and edit links against
the PR checkout). Other repos in protected_repositories remain unchanged
because they have no docs workflow today.

Why a per-repo map instead of a single shared list: the contexts that
must pass differ by repo (a Rust repo needs CI / check; the marketplace
needs its own validation; homebrew-tap has none). Sharing one list would
either over-require contexts that do not exist on some repos (blocking
all merges there forever) or under-require them on the repos that need
the gate.

strict_required_status_checks_policy is left at the default false. PR
authors are not forced to rebase onto the latest main before each merge;
the check just needs to have passed on the head commit.

Signed-off-by: Alexey Zhokhov <alexey@zhokhov.com>
Co-authored-by: Claude <noreply@anthropic.com>
donbeave added a commit that referenced this pull request May 7, 2026
…ly (#11)

Fix the required-status-checks context I introduced in #10. The
context "Docs / build" was the workflow / job display name that
appears in the GitHub PR UI, but GitHub matches against the bare
check-run name, which for the Docs workflow is "build". Result:
zero check-runs ever satisfied the rule, every PR's
mergeStateStatus turned BLOCKED right after #10 applied (see
jackin-project/jackin#180 — green build but blocked merge).

Switch the map to a transitional dual-context list:

- "build" — the current docs link-check job name. Restores merges
  immediately after this applies.
- "docs-link-check" — the unique name the docs job will rename to in
  jackin-project/jackin (PR to follow). Listing it here ahead of the
  rename keeps PRs unblocked across the rename window.

Once the rename PR merges in jackin, drop "build" from this list in
a follow-up apply so we don't have an extra context that could be
silently satisfied by a future unrelated workflow's "build" job.

Verified locally:
- `tofu fmt -check` clean
- `tofu validate` clean
- Pre-commit secret scan clean

Signed-off-by: Alexey Zhokhov <alexey@zhokhov.com>
Co-authored-by: Claude <noreply@anthropic.com>
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