Skip to content

Render the tap tokens the only way goreleaser allows - #11

Merged
adhikjoshi merged 1 commit into
mainfrom
fix/goreleaser-tap-token
Sep 18, 2026
Merged

adhikjoshi merged 1 commit into
mainfrom
fix/goreleaser-tap-token

Conversation

@adhikjoshi

@adhikjoshi adhikjoshi commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

The v0.2.1 retry, the first run with a working Homebrew/Scoop PAT, failed in GoReleaser:

homebrew cask: template: failed to apply "{{ envOrDefault \"HOMEBREW_TAP_GITHUB_TOKEN\" \"unset\" }}": function "envOrDefault" not defined
scoop manifests: template: failed to apply "{{ envOrDefault \"SCOOP_BUCKET_GITHUB_TOKEN\" \"unset\" }}": function "envOrDefault" not defined

GoReleaser renders repository.token through ApplySingleEnvOnly, which accepts exactly {{ .Env.NAME }} and has no template functions. envOrDefault came in with #8 and never ran: while the PATs were dead, skip_upload stopped the publish before the token was rendered, so goreleaser check and every skipped run passed.

  • token{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }} / {{ .Env.SCOOP_BUCKET_GITHUB_TOKEN }}
  • skip_upload keeps envOrDefault: that field uses the full template engine, where an unset variable must still read as "false".

Verification

  • goreleaser check passes.
  • Both token strings match GoReleaser's envOnlyRe (^{{\s*\.Env\.[^.\s}]+\s*}}$).
  • The new PAT reads both tap repos (HTTP 200), which is the check the workflow runs first.
  • The v0.2.1 assets that the failed retry replaced are intact: all 10 match checksums.txt.

Follow-up

A retry of v0.2.1 checks out the tag, which still has the broken config, so the taps can only get this fix through a new tag. After merge: tag v0.2.2. It has the same CLI code as v0.2.1.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NJxK2YGapyVchfyE1F8CpR


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

The first release run with a working tap PAT (the v0.2.1 retry) failed:

  homebrew cask: template: failed to apply
    "{{ envOrDefault \"HOMEBREW_TAP_GITHUB_TOKEN\" \"unset\" }}":
    function "envOrDefault" not defined

goreleaser renders a repository token through ApplySingleEnvOnly, which
accepts exactly `{{ .Env.NAME }}` (^{{\s*\.Env\.[^.\s}]+\s*}}$) and has no
template functions. envOrDefault went in with #8 and was never exercised: while
the PATs were dead, skip_upload short-circuited the publish before the token was
rendered, so `goreleaser check` and every skipped run passed.

skip_upload keeps envOrDefault — that field goes through the full template
engine, and there an unset variable must still read as "false".

The GitHub assets that retry replaced are intact: all ten match checksums.txt.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJxK2YGapyVchfyE1F8CpR
@adhikjoshi
adhikjoshi merged commit a96e7e9 into main Sep 18, 2026
8 checks passed
@adhikjoshi
adhikjoshi deleted the fix/goreleaser-tap-token branch September 18, 2026 15:51
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