(t *TestResultSummary, issues []*github.Issue, labels []string)
| 55 | } |
| 56 | |
| 57 | func 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 | } |
no test coverage detected
searching dependent graphs…