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

Function remoteTagExists

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

Source from the content-addressed store, hash-verified

37}
38
39func remoteTagExists(httpClient *http.Client, repo ghrepo.Interface, tagName string) (bool, error) {
40 gql := api.NewClientFromHTTP(httpClient)
41 qualifiedTagName := fmt.Sprintf("refs/tags/%s", tagName)
42 var query struct {
43 Repository struct {
44 Ref struct {
45 ID string
46 } `graphql:"ref(qualifiedName: $tagName)"`
47 } `graphql:"repository(owner: $owner, name: $name)"`
48 }
49 variables := map[string]any{
50 "owner": githubv4.String(repo.RepoOwner()),
51 "name": githubv4.String(repo.RepoName()),
52 "tagName": githubv4.String(qualifiedTagName),
53 }
54 err := gql.Query(repo.RepoHost(), "RepositoryFindRef", &query, variables)
55 return query.Repository.Ref.ID != "", err
56}

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