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

Function issueTransfer

pkg/cmd/issue/transfer/transfer.go:102–133  ·  view source on GitHub ↗
(httpClient *http.Client, issueID string, destRepo ghrepo.Interface)

Source from the content-addressed store, hash-verified

100}
101
102func 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}

Callers 1

transferRunFunction · 0.85

Calls 4

NewClientFromHTTPFunction · 0.92
IssueRepoInfoFunction · 0.92
MutateMethod · 0.65
RepoHostMethod · 0.65

Tested by

no test coverage detected