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

Function remoteTagExists

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

Source from the content-addressed store, hash-verified

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

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