Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pkg/cmd/release/shared/fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ func FetchRefSHA(ctx context.Context, httpClient *http.Client, repo ghrepo.Inter
} `json:"object"`
}
if err := json.NewDecoder(resp.Body).Decode(&ref); err != nil {
return "", err
// release not found
return "", ErrReleaseNotFound
Copy link
Member

Choose a reason for hiding this comment

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

This change also affects other release subcmds. I agree with CCR in that this error can have other reasons.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When fetching the ref SHA of a tag, a partial semver match returns a 200 response with an empty body, which causes the JSON decode to fail.
For example, if the tag is v1.0.0, only refs/tags/v1.0.0 will work — v1 or v1.0 will return 200 with empty body.

This behavior aligns with other gh release commands, which also require the exact tag name, otherwise would return release not found. Partial semver versions won’t work — only the full, exact tag is accepted.

}

return ref.Object.SHA, nil
Expand Down
Loading