fix: use --snapshot flag for GoReleaser dry-run mode#40
Merged
Conversation
When running via workflow_dispatch in dry-run mode, GoReleaser failed because the tag does not exist on the commit. Use --snapshot to skip git state validation and build without publishing. Also skip Docker setup/login steps during dry-run.
Contributor
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdjusts the GitHub Actions release workflow so that dry-run executions use GoReleaser’s snapshot mode and skip Docker-related steps, preventing git tag validation failures while avoiding unnecessary registry operations. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path=".github/workflows/release.yml" line_range="62-64" />
<code_context>
version: "~> v2"
- args: release --clean --release-notes changes/${{ steps.resolve_tag.outputs.tag }}.md ${{ github.event.inputs.dry_run == 'true' && '--skip-publish' || '' }}
+ args: >-
+ ${{ github.event.inputs.dry_run == 'true'
+ && format('release --clean --snapshot --release-notes changes/{0}.md', steps.resolve_tag.outputs.tag)
+ || format('release --clean --release-notes changes/{0}.md', steps.resolve_tag.outputs.tag) }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
</code_context>
<issue_to_address>
**suggestion:** Consider simplifying the conditional `args` expression to reduce duplication and improve readability.
Both ternary branches repeat `release --clean` and only differ by `--snapshot`. Consider computing the common base args once (e.g., via a job `env` or a prior step that sets an output) and conditionally appending `--snapshot` when `dry_run` is true. This keeps the flags in one place and reduces future maintenance risk.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
…lve step Move --snapshot flag computation into the resolve_tag step output to eliminate duplicated args in the ternary expression.
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
--snapshotflag when running GoReleaser in dry-run mode viaworkflow_dispatchProblem
When running the release workflow via
workflow_dispatchin dry-run mode, GoReleaser failed with:GoReleaser validates that the tag exists and points to the current commit. In dry-run mode (no actual tag pushed), this validation always fails.
Fix
Use
--snapshotflag in dry-run mode, which tells GoReleaser to skip git state validation and build artifacts locally without publishing. Also gate Docker-related steps behind the dry-run check.Test plan
--snapshotproduces artifacts in dist/ with snapshot version names