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

Function remoteTagExists

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

Source from the content-addressed store, hash-verified

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

Callers 1

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