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

Function remoteTagExists

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

Source from the content-addressed store, hash-verified

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

Callers 1

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