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

Function remoteTagExists

pkg/cmd/release/create/http.go:44–61  ·  view source on GitHub ↗
(httpClient *http.Client, repo ghrepo.Interface, tagName string)

Source from the content-addressed store, hash-verified

42}
43
44func remoteTagExists(httpClient *http.Client, repo ghrepo.Interface, tagName string) (bool, error) {
45 gql := api.NewClientFromHTTP(httpClient)
46 qualifiedTagName := fmt.Sprintf("refs/tags/%s", tagName)
47 var query struct {
48 Repository struct {
49 Ref struct {
50 ID string
51 } `graphql:"ref(qualifiedName: $tagName)"`
52 } `graphql:"repository(owner: $owner, name: $name)"`
53 }
54 variables := map[string]interface{}{
55 "owner": githubv4.String(repo.RepoOwner()),
56 "name": githubv4.String(repo.RepoName()),
57 "tagName": githubv4.String(qualifiedTagName),
58 }
59 err := gql.Query(repo.RepoHost(), "RepositoryFindRef", &query, variables)
60 return query.Repository.Ref.ID != "", err
61}
62
63func getTags(httpClient *http.Client, repo ghrepo.Interface, limit int) ([]tag, error) {
64 u, err := safeurl.JoinPathWithHostPrefix(ghinstance.RESTPrefix(repo.RepoHost()), "repos", repo.RepoOwner(), repo.RepoName(), "tags")

Callers 1

createRunFunction · 0.70

Calls 6

NewClientFromHTTPFunction · 0.92
StringMethod · 0.65
RepoOwnerMethod · 0.65
RepoNameMethod · 0.65
QueryMethod · 0.65
RepoHostMethod · 0.65

Tested by

no test coverage detected