Conversation
goreleaser v2 exec's each hook string via shlex.Split rather than passing it to a shell, so shell builtins (export), operators (&&, ;), and command substitution ($(...)) only work when wrapped in `sh -c "<...>"`. The wfctl strict-contracts hook used `export` and failed v0.9.0's release-r2 (run 25274980854) with `exec: "export": executable file not found in $PATH`. The two sed hooks above only worked accidentally: goreleaser passed everything past the first whitespace as positional args to `sed`, which silently absorbs `&&` and `rm` as positional args. The mutations to plugin.json may not actually have been happening as intended in releases — wrapping all three in `sh -c` makes the behaviour match the apparent intent. Pair with #57 — both unblock the v0.9.0 release pipeline. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The prior commit's `sh -c "..."` form was a plain (non-quoted) YAML scalar, so the embedded `:` inside URLs (e.g. https://...) was parsed as YAML mapping syntax. yaml errored: `mapping values are not allowed in this context`. Wrap each hook in YAML double-quotes with proper backslash-escaping of the inner shell double-quotes. Validated locally with `goreleaser/goreleaser:v2.15.4 check`.
There was a problem hiding this comment.
Pull request overview
Updates the repository’s GoReleaser v2 configuration so the before.hooks steps reliably execute as intended (including shell builtins/operators), preventing release workflow failures during v0.9.0 publishing.
Changes:
- Wrap all
before.hookscommands insh -csoexport,&&, and$(...)are executed by a shell rather than being shlex-split into argv. - Add explanatory comments documenting the GoReleaser v2 hook execution behavior and why the wrapping is required.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
After PR #57 unblocked the v0.9.0 release from the top-level
after:issue, goreleaser run #2 (id 25274980854) failed with:goreleaser v2 exec's each hook string via
shlex.Splitrather than passing it to a shell, so shell builtins (export), operators (&&,;), and command substitution ($(...)) only work when wrapped insh -c "<...>". The twosedhooks above only worked accidentally — goreleaser passed everything past the first whitespace as positional args tosed, which silently absorbed&&andrmas positional args (the mutations to plugin.json may not have been happening as intended).Fix
Wrap all three
before.hooksinsh -c "<...>". Also YAML-quote the outer string so the embedded:inside URLs (github.com:.../...) doesn't get parsed as YAML mapping syntax.Verification
(The deprecation is non-blocking + pre-existing.)
After merge
The v0.9.0 tag will be force-moved again to the new fix-included commit so goreleaser re-runs.
🤖 Generated with Claude Code