(client *Client, host string, repoID, issueID, branchID, branchName string)
| 13 | } |
| 14 | |
| 15 | func CreateLinkedBranch(client *Client, host string, repoID, issueID, branchID, branchName string) (string, error) { |
| 16 | var mutation struct { |
| 17 | CreateLinkedBranch struct { |
| 18 | LinkedBranch struct { |
| 19 | ID string |
| 20 | Ref struct { |
| 21 | Name string |
| 22 | } |
| 23 | } |
| 24 | } `graphql:"createLinkedBranch(input: $input)"` |
| 25 | } |
| 26 | |
| 27 | input := githubv4.CreateLinkedBranchInput{ |
| 28 | IssueID: githubv4.ID(issueID), |
| 29 | Oid: githubv4.GitObjectID(branchID), |
| 30 | } |
| 31 | if repoID != "" { |
| 32 | repo := githubv4.ID(repoID) |
| 33 | input.RepositoryID = &repo |
| 34 | } |
| 35 | if branchName != "" { |
| 36 | name := githubv4.String(branchName) |
| 37 | input.Name = &name |
| 38 | } |
| 39 | variables := map[string]interface{}{ |
| 40 | "input": input, |
| 41 | } |
| 42 | |
| 43 | err := client.Mutate(host, "CreateLinkedBranch", &mutation, variables) |
| 44 | if err != nil { |
| 45 | return "", err |
| 46 | } |
| 47 | |
| 48 | return mutation.CreateLinkedBranch.LinkedBranch.Ref.Name, nil |
| 49 | } |
| 50 | |
| 51 | func ListLinkedBranches(client *Client, repo ghrepo.Interface, issueNumber int) ([]LinkedBranch, error) { |
| 52 | var query struct { |
no test coverage detected