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

Function remoteTagExists

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

Source from the content-addressed store, hash-verified

55}
56
57func remoteTagExists(httpClient *http.Client, repo ghrepo.Interface, tagName string) (bool, error) {
58 gql := api.NewClientFromHTTP(httpClient)
59 qualifiedTagName := fmt.Sprintf("refs/tags/%s", tagName)
60 var query struct {
61 Repository struct {
62 Ref struct {
63 ID string
64 } `graphql:"ref(qualifiedName: $tagName)"`
65 } `graphql:"repository(owner: $owner, name: $name)"`
66 }
67 variables := map[string]interface{}{
68 "owner": githubv4.String(repo.RepoOwner()),
69 "name": githubv4.String(repo.RepoName()),
70 "tagName": githubv4.String(qualifiedTagName),
71 }
72 err := gql.Query(repo.RepoHost(), "RepositoryFindRef", &query, variables)
73 return query.Repository.Ref.ID != "", err
74}

Callers 1

editRunFunction · 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