MCPcopy Index your code
hub / github.com/cli/cli / remoteTagExists

Function remoteTagExists

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

Source from the content-addressed store, hash-verified

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

Callers 1

editRunFunction · 0.70

Calls 6

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

Tested by

no test coverage detected