Skip to content

fix(ci): prevent dirty git state in release workflow#36

Open
miguelsanchez-upsun wants to merge 1 commit intomainfrom
fix-goreleaser-dirty-state
Open

fix(ci): prevent dirty git state in release workflow#36
miguelsanchez-upsun wants to merge 1 commit intomainfrom
fix-goreleaser-dirty-state

Conversation

@miguelsanchez-upsun
Copy link
Copy Markdown
Collaborator

Summary

Fixes the "git is in a dirty state" error that occurs when running the release workflow with upload_repos enabled.

The workflow was using sed to modify .goreleaser.yaml in-place when the upload_taps checkbox was enabled, causing GoReleaser to detect modified files and fail validation.

Solution: Replace file modification with environment variable approach:

  • Use GoReleaser's envOrDefault template function to read SKIP_UPLOAD_TAPS from environment
  • Set the environment variable in the workflow based on the upload_taps input
  • Preserves identical GitHub UI behavior (same checkbox, same functionality)

Test plan

  • Verify workflow runs successfully without upload_taps checkbox (should use auto)
  • Verify workflow runs successfully with upload_taps checkbox enabled (should use false)
  • Confirm no "dirty git state" error appears in GoReleaser output
  • Validate that Homebrew/Scoop uploads work as expected when enabled

🤖 Generated with Claude Code

The workflow was using sed to modify .goreleaser.yaml when upload_taps
was enabled, causing GoReleaser to fail with "git is in a dirty state".

Changed to use environment variable SKIP_UPLOAD_TAPS with GoReleaser's
envOrDefault template function. This preserves the same GitHub UI
checkbox behavior while avoiding file modifications during the pipeline.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 30, 2026 08:07
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the release pipeline to avoid modifying tracked files during a run (which caused GoReleaser “dirty git state” validation failures) by switching tap upload control from an in-place sed edit to an environment-driven GoReleaser template.

Changes:

  • Replace skip_upload: auto literals in .goreleaser.yaml with an envOrDefault template reading SKIP_UPLOAD_TAPS.
  • Remove the workflow step that edited .goreleaser.yaml in-place with sed.
  • Set SKIP_UPLOAD_TAPS in the release workflow based on the upload_taps input.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
.goreleaser.yaml Makes tap/scoop skip_upload configurable via environment instead of a committed-file edit.
.github/workflows/release.yml Eliminates in-workflow file mutation and sets SKIP_UPLOAD_TAPS for make release.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants