in dev/testsreporter/reporter.go [199:220]
func closedIssueFromDescription(issue *githubIssue) (string, error) {
description := issue.description
re := regexp.MustCompile(`Latest issue closed for the same test: (?P<url>https://github\.com/elastic/integrations/issues/\d+)`)
links := []string{}
for _, matches := range re.FindAllStringSubmatch(description, -1) {
for i, name := range re.SubexpNames() {
if i == 0 || name != "url" {
continue
}
links = append(links, matches[i])
}
}
if len(links) > 1 {
return "", fmt.Errorf("incorrect number of issues found for the previous closed issue: %d", len(links))
}
if len(links) == 0 {
return "", nil
}
return links[0], nil
}