| 41 | } |
| 42 | |
| 43 | func 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 | |
| 62 | func 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) |