Skip to content

Trim tag name on gh release create #7737

@harveysanders

Description

@harveysanders

Describe the feature or problem you’d like to solve

While using gh release create, I accidentally added a preceding space character for the tag name.

$ gh release create
? Choose a tag Create a new tag
? Tag name  REL-20230721-1724
? Title (optional) REL-20230721-1724
? Release notes Write using generated notes as template
? Is this a prerelease? No
? Submit? Publish release
HTTP 422: Validation Failed (https://api.github.com/repos/[org]/[repo]/releases)
tag_name is not a valid tag
tag_name is not well-formed
Published releases must have a valid tag

After running again to make sure that was the issue, I remove the leading space and all is golden.

$ gh release create
? Choose a tag Create a new tag
? Tag name REL-20230721-1724
? Title (optional) REL-20230721-1724
? Release notes Write using generated notes as template
? Is this a prerelease? No
? Submit? Publish release
https://github.com/[org]/[repo]/releases/tag/REL-20230721-1724

Proposed solution

Trim the input string before committing as tag name input.

How will it benefit CLI and its users?
They won't lose any time debugging a stray space character.

Additional context

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementa request to improve CLIhelp wantedContributions welcome

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions