Repository navigation
ci: require PRs to main to come through no-mistakes - #95
Conversation
Adds the "PR must be raised via no-mistakes" check that firstmate and SSHHIP already enforce, so hand-raised PRs to main cannot skip the review/test/lint pipeline. All exemption logic lives in .github/scripts/no-mistakes-gate.sh, a single executable surface the workflow runs and the tests drive: - github-actions[bot] and dependabot[bot] pass. - release-please release PRs pass structurally - reserved head branch prefix (release-please-- or the legacy release-please/), same-repo (non-fork) head, and the Release Please body footer - never on author identity, so the exemption survives a future switch to a PAT and a fork copying the release body still fails. release-please opens treehouse's release PRs with GITHUB_TOKEN, and GitHub creates no workflow runs for those PRs (verified: release PR head commits carry zero check runs). The required check could therefore never report on a release PR. release.yml now publishes that status itself, running the same gate script with the bot exemption deliberately defeated, so only a structurally genuine release PR is stamped. The gate workflow intentionally carries no path filter, since a filtered required check never reports and blocks the PR forever; the release-CI drift test now encodes that rule for required-check workflows and keeps the exclusion rule for every other pull_request workflow.
The gate script is read from the base branch by design, so a PR based on a main that predates it hits a bare 'No such file or directory'. Fail closed with a message that names the fix instead.
Confidence Score: 3/5This PR should not merge until the required gate uses evidence that a PR author cannot reproduce merely by editing the PR body. The central enforcement path accepts a fixed public marker from contributor-controlled input, so a manually raised PR can satisfy the check without traversing the pipeline the check claims to require; mutable action references add a separate non-blocking trust-boundary weakness. Files Needing Attention: .github/scripts/no-mistakes-gate.sh, .github/workflows/no-mistakes-required.yml, .github/workflows/release.yml
|
|
Note for the merger: the This is the bootstrapping case the delivery mode accounts for; the check is not required on |
Summary
Adds the
PR must be raised via no-mistakesrequired check to treehouse, matching firstmate and SSHHIP, with a release-please exemption so release PRs are never blocked.This is a bootstrapping change: the check cannot gate the PR that adds it, so this PR is raised directly rather than through the no-mistakes pipeline.
What changed
.github/workflows/no-mistakes-required.yml- job named exactlyPR must be raised via no-mistakes, onpull_requesttomain. The gate script is checked out from the base SHA, so a PR cannot weaken the check that judges it..github/scripts/no-mistakes-gate.sh- the single executable decision surface. A PR passes when it carries the markerUpdates from [git push no-mistakes](https://github.com/kunchenguid/no-mistakes)(confirmed against this repo's own pipeline PRs, e.g. feat(pool): add stable lease identities #68), or is opened bygithub-actions[bot]/dependabot[bot], or is structurally release-please's own PR: reserved head branch prefix (release-please--, plus the legacyrelease-please/) and same-repo (non-fork) head and theThis PR was generated with [Release Please]body footer. Never author identity, so a future PAT switch stays covered and a human PR or fork spoofing the release body still fails.no_mistakes_gate_test.go- behavioral test that parses the real workflow, resolves itsenv:${{ github.event.pull_request.* }}expressions against synthesized GitHub payloads, and executes the actual step shell. Covers: release-please PR exempt (bot- and human-authored), legacy branch prefix exempt, both bots exempt, human PR with signature passes, human PR without signature fails, empty body fails, borrowed release branch name alone fails, fork copying the release body fails, release body on an ordinary branch fails.Release PRs would otherwise be blocked
release-please opens treehouse's release PRs with
GITHUB_TOKEN, and GitHub creates no workflow runs for those PRs. Verified empirically: the head commits of release PRs #78, #69, #56 and #38 carry zero check runs, both before and after the #77 path exclusions. A required check therefore could never report on a release PR, and every release would sit blocked on a status that can never arrive - owner-override only.So
release.ymlgains arelease-pr-gate-statusjob that publishes the required context on the open release PR's head SHA. It runs the same gate script withPR_AUTHORdeliberately overridden, which defeats the bot exemption, so a status is stamped only when the structural release-please conditions hold. Verified locally against the real payloads of #78 (stamped) and #94 (skipped, fork).Also: the gate workflow deliberately has no path filter, because a path-filtered required check never reports and blocks the PR forever.
TestPullRequestWorkflowsExcludeReleasePleaseOutputsnow encodes both rules - required-check workflows must not filter by path, every otherpull_requestworkflow must still exclude the release-please output set - and fails if a second workflow ever claims the required-check name.Sequencing
The workflow lands on
mainfirst; the required-status-check ruleset (PR must be raised via no-mistakes, Admin bypass) is added right after, so no PR is ever left waiting on a check that cannot run.Testing
go test ./...- all greengo vet ./...,gofmt -l .- clean