Skip to content

Add --tag to release upload for parity with release create - #172

Open
CloudCorpRecords wants to merge 1 commit into
git-pkgs:mainfrom
CloudCorpRecords:feat/168-release-upload-tag-flag
Open

CloudCorpRecords wants to merge 1 commit into
git-pkgs:mainfrom
CloudCorpRecords:feat/168-release-upload-tag-flag

Conversation

@CloudCorpRecords

Copy link
Copy Markdown

Fixes #168

forge release create takes --tag, but forge release upload only accepted the tag positionally, which is awkward in scripts. This adds --tag to upload:

forge release upload v1.0.0 app.zip          # unchanged
forge release upload --tag v1.0.0 app.zip    # new
  • With --tag, the single argument is the file; without it, the existing <tag> <file> form applies, so nothing breaks.
  • Supplying --tag and a positional tag, no tag at all, or the wrong number of arguments gives a clear error.
  • The argument handling lives in a small pure helper, uploadTagAndFile, so it is unit-tested directly (7 cases), plus a test that the flag exists.

I left release download <tag> <asset-name> alone since the issue is about upload; happy to give it the same --tag treatment in a follow-up if you want.

Checks: go test -race ./... and golangci-lint run pass locally.

This change was written with Claude Code (an AI coding agent); I ran the tests and linter above.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@andrew andrew left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please address these two points:

  • In internal/cli/release.go, explicitly empty --tag bypasses conflict validation: forge release upload --tag='' v1.0.0 app.zip accepts the positional tag and proceeds to repository resolution. Check cmd.Flags().Changed("tag") and reject empty flag values so an unset script variable cannot silently select positional mode.
  • In internal/cli/release_test.go, the new tests only call the parser helper and check that the flag exists. Add tests through command execution for both supported forms and invalid combinations, including an empty --tag, and assert the tag and file contents passed to UploadAsset. This will cover flag binding and the upload path together.

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.

forge release and upload parameter inconsistency

2 participants