Skip to content

Commit 1ad9b0b

Browse files
committed
Have FindDraftRelease be truer to its name
1 parent d4b45c6 commit 1ad9b0b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/cmd/release/shared/fetch.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ func FetchLatestRelease(httpClient *http.Client, baseRepo ghrepo.Interface) (*Re
113113
return &release, nil
114114
}
115115

116-
// FindDraftRelease interates over all releases in a repository until it finds one that matches tagName.
116+
// FindDraftRelease returns the latest draft release that matches tagName.
117117
func FindDraftRelease(httpClient *http.Client, baseRepo ghrepo.Interface, tagName string) (*Release, error) {
118118
path := fmt.Sprintf("repos/%s/%s/releases", baseRepo.RepoOwner(), baseRepo.RepoName())
119119
url := ghinstance.RESTPrefix(baseRepo.RepoHost()) + path
@@ -148,7 +148,7 @@ func FindDraftRelease(httpClient *http.Client, baseRepo ghrepo.Interface, tagNam
148148
}
149149

150150
for _, r := range releases {
151-
if r.TagName == tagName {
151+
if r.IsDraft && r.TagName == tagName {
152152
return &r, nil
153153
}
154154
}

0 commit comments

Comments
 (0)