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

Function CreateLinkedBranch

api/queries_branch_issue_reference.go:15–49  ·  view source on GitHub ↗
(client *Client, host string, repoID, issueID, branchID, branchName string)

Source from the content-addressed store, hash-verified

13}
14
15func 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
51func ListLinkedBranches(client *Client, repo ghrepo.Interface, issueNumber int) ([]LinkedBranch, error) {
52 var query struct {

Callers 1

developRunCreateFunction · 0.92

Calls 3

IDMethod · 0.65
MutateMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected