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

Function FetchLatestRelease

pkg/cmd/release/shared/fetch.go:237–243  ·  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

235
236// FetchLatestRelease finds the latest published release for a repository.
237func FetchLatestRelease(ctx context.Context, httpClient *http.Client, repo ghrepo.Interface) (*Release, error) {
238 url, err := safeurl.JoinPathWithHostPrefix(ghinstance.RESTPrefix(repo.RepoHost()), "repos", repo.RepoOwner(), repo.RepoName(), "releases", "latest")
239 if err != nil {
240 return nil, err
241 }
242 return fetchReleasePath(ctx, httpClient, url)
243}
244
245// fetchDraftRelease returns the first draft release that has tagName as its pending tag.
246func fetchDraftRelease(ctx context.Context, httpClient *http.Client, repo ghrepo.Interface, tagName string) (*Release, error) {

Callers 5

verifyRunFunction · 0.92
viewRunFunction · 0.92
isNewReleaseFunction · 0.92
verifyAssetRunFunction · 0.92
downloadRunFunction · 0.92

Calls 6

JoinPathWithHostPrefixFunction · 0.92
RESTPrefixFunction · 0.92
fetchReleasePathFunction · 0.85
RepoHostMethod · 0.65
RepoOwnerMethod · 0.65
RepoNameMethod · 0.65

Tested by

no test coverage detected