Skip to content

ci: fail release-please when RELEASE_PLEASE_TOKEN is unset - #54

Merged
johnnyhuy merged 3 commits into
mainfrom
ci/guard-release-please-token
Oct 6, 2026
Merged

johnnyhuy merged 3 commits into
mainfrom
ci/guard-release-please-token

Conversation

@johnnyhuy

Copy link
Copy Markdown
Contributor

Problem

PR #52 gave release-please.yml a trusted token:

token: ${{ secrets.RELEASE_PLEASE_TOKEN || github.token }}

but RELEASE_PLEASE_TOKEN did not exist at the time, and the || github.token fallback is silent. That silent fallback is the exact state this repo has been running in for months, and its consequences were only found today:

Root cause (worked out in #52): GitHub does not create normal workflow runs for events produced by GITHUB_TOKEN — they land in an approval-required state with no jobs. Human and Dependabot PRs were unaffected, which is why the failure was invisible until someone compared run metadata against a passing PR.

Fix

Add a first step that fails the job when the secret is unset, with the corrective command in the error message:

::error title=RELEASE_PLEASE_TOKEN missing::release-please would fall back to
GITHUB_TOKEN, which cannot trigger workflows: CI on its PRs sits approval-gated
with zero jobs and its releases never fire goreleaser. Create the secret with
gh secret set RELEASE_PLEASE_TOKEN -R <repo>

The secret now exists (created today), so this is a tripwire for the next regression — a deleted secret, a rename, or a fresh clone of this repo — rather than a fix for a current break.

Trade-off, stated plainly: with this guard, a missing secret stops releases entirely instead of degrading to a half-working state. That is deliberate: a red job with the fix command in its output is strictly better than releases that silently produce nothing, which is what happened here. Dropping back to warn-and-continue is a one-word change (exit 1 → ::warning).

Not covered: the guard only checks presence. A present-but-expired or revoked token still passes and will fail downstream in release-please itself. Detecting that would mean an API call (gh api /user) in the guard, which I left out to keep this a pure YAML change.

Validation

  • actionlint clean (v1.7.12).
  • mise run ci green — lint 0 issues, vet, race tests (including the new test/e2e packages), build, generate-verify.
  • No Go or docs changes; the diff is .github/workflows/release-please.yml only.

johnnyhuy and others added 3 commits October 5, 2026 00:10
The token line added in #52 falls back to github.token when the secret is
missing, which is exactly the state that shipped no releases: events from
GITHUB_TOKEN get approval-gated runs with zero jobs on the PR, and the
release event never fires, so goreleaser never ran. That degradation was
silent for months. A first step now fails the job with the fix command in
the error, so a deleted or renamed secret is visible immediately.

Co-authored-by: opencode-agent[bot] <219766164+opencode-agent[bot]@users.noreply.github.com>
@johnnyhuy
johnnyhuy marked this pull request as ready for review October 6, 2026 11:56
@johnnyhuy
johnnyhuy merged commit a5ca147 into main Oct 6, 2026
@johnnyhuy
johnnyhuy deleted the ci/guard-release-please-token branch October 6, 2026 11:56
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