(httpClient *http.Client, issueID string, destRepo ghrepo.Interface)
| 100 | } |
| 101 | |
| 102 | func issueTransfer(httpClient *http.Client, issueID string, destRepo ghrepo.Interface) (string, error) { |
| 103 | var destinationRepoID string |
| 104 | if r, ok := destRepo.(*api.Repository); ok { |
| 105 | destinationRepoID = r.ID |
| 106 | } else { |
| 107 | apiClient := api.NewClientFromHTTP(httpClient) |
| 108 | r, err := api.IssueRepoInfo(apiClient, destRepo) |
| 109 | if err != nil { |
| 110 | return "", err |
| 111 | } |
| 112 | destinationRepoID = r.ID |
| 113 | } |
| 114 | |
| 115 | var mutation struct { |
| 116 | TransferIssue struct { |
| 117 | Issue struct { |
| 118 | URL string |
| 119 | } |
| 120 | } `graphql:"transferIssue(input: $input)"` |
| 121 | } |
| 122 | |
| 123 | variables := map[string]interface{}{ |
| 124 | "input": githubv4.TransferIssueInput{ |
| 125 | IssueID: issueID, |
| 126 | RepositoryID: destinationRepoID, |
| 127 | }, |
| 128 | } |
| 129 | |
| 130 | gql := api.NewClientFromHTTP(httpClient) |
| 131 | err := gql.Mutate(destRepo.RepoHost(), "IssueTransfer", &mutation, variables) |
| 132 | return mutation.TransferIssue.Issue.URL, err |
| 133 | } |
no test coverage detected