MCPcopy Create free account
hub / github.com/cli/cli / FetchLatestRelease

Function FetchLatestRelease

pkg/cmd/release/shared/fetch.go:228–234  ·  view source on GitHub ↗

FetchLatestRelease finds the latest published release for a repository.

(ctx context.Context, httpClient *http.Client, repo ghrepo.Interface)

Source from the content-addressed store, hash-verified

226
227// FetchLatestRelease finds the latest published release for a repository.
228func 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.
237func fetchDraftRelease(ctx context.Context, httpClient *http.Client, repo ghrepo.Interface, tagName string) (*Release, error) {

Callers 6

verifyRunFunction · 0.92
viewRunFunction · 0.92
isNewReleaseFunction · 0.92
verifyAssetRunFunction · 0.92
downloadRunFunction · 0.92
TestFetchLatestReleaseFunction · 0.85

Calls 5

JoinPathFunction · 0.92
fetchReleasePathFunction · 0.85
RepoOwnerMethod · 0.65
RepoNameMethod · 0.65
RepoHostMethod · 0.65

Tested by 1

TestFetchLatestReleaseFunction · 0.68