-
Notifications
You must be signed in to change notification settings - Fork 7.8k
fix error for ErrReleaseNotFound when fetching ref #11451
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change also affects other
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. 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 | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.