FetchLatestRelease finds the latest published release for a repository.
(ctx context.Context, httpClient *http.Client, repo ghrepo.Interface)
| 226 | |
| 227 | // FetchLatestRelease finds the latest published release for a repository. |
| 228 | func FetchLatestRelease(ctx context.Context, httpClient *http.Client, repo ghrepo.Interface) (*Release, error) { |
| 229 | path, err := safeurl.JoinPath("repos", repo.RepoOwner(), repo.RepoName(), "releases", "latest") |
| 230 | if err != nil { |
| 231 | return nil, err |
| 232 | } |
| 233 | return fetchReleasePath(ctx, httpClient, repo.RepoHost(), path) |
| 234 | } |
| 235 | |
| 236 | // fetchDraftRelease returns the first draft release that has tagName as its pending tag. |
| 237 | func fetchDraftRelease(ctx context.Context, httpClient *http.Client, repo ghrepo.Interface, tagName string) (*Release, error) { |