MCPcopy
hub / github.com/etcd-io/etcd / createIssueIfNonExist

Function createIssueIfNonExist

tools/testgrid-analysis/cmd/github.go:57–78  ·  view source on GitHub ↗
(t *TestResultSummary, issues []*github.Issue, labels []string)

Source from the content-addressed store, hash-verified

55}
56
57func createIssueIfNonExist(t *TestResultSummary, issues []*github.Issue, labels []string) {
58 // check if there is already an open issue regarding this test
59 for _, issue := range issues {
60 if strings.Contains(*issue.Title, t.Name) {
61 fmt.Printf("%s is already open for test %s\n\n", issue.GetHTMLURL(), t.Name)
62 return
63 }
64 }
65 fmt.Printf("Opening new issue for %s\n", t.Name)
66 client := github.NewClient(nil).WithAuthToken(os.Getenv("GITHUB_TOKEN"))
67 ctx := context.Background()
68 req := &github.IssueRequest{
69 Title: github.String(fmt.Sprintf("Flaky test %s", t.Name)),
70 Body: &t.IssueBody,
71 Labels: &labels,
72 }
73 issue, _, err := client.Issues.Create(ctx, githubOwner, githubRepo, req)
74 if err != nil {
75 panic(err)
76 }
77 fmt.Printf("New issue %s created for %s\n\n", issue.GetHTMLURL(), t.Name)
78}

Callers 1

createIssuesFunction · 0.85

Calls 3

ContainsMethod · 0.65
StringMethod · 0.65
CreateMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…