in tools/eksDistroBuildToolingOpsTools/pkg/externalplugin/server.go [157:187]
func (s *Server) handleIssueComment(l *logrus.Entry, ic github.IssueCommentEvent) error {
// Only consider newly opened issues.
if ic.Action != github.IssueCommentActionCreated {
return nil
}
org := ic.Repo.Owner.Login
repo := ic.Repo.Name
num := ic.Issue.Number
commentAuthor := ic.Comment.User.Login
// Do not create a new logger, its fields are re-used by the caller in case of errors
*l = *l.WithFields(logrus.Fields{
github.OrgLogField: org,
github.RepoLogField: repo,
github.PrLogField: num,
})
// backportMatches should hold 3 values:
// backportMatches[0] holds the full comment body
// backportMatches[1] holds the project
// backportMatches[2] holds the versions to backport to unparsed. ("v1.2.2 ...")
backportMatches := backportRe.FindStringSubmatch(ic.Comment.Body)
versions := versionsRe.FindAllString(backportMatches[2], -1)
if len(backportMatches) != 0 && len(backportMatches) == 3 {
if err := s.handleBackportRequest(l, commentAuthor, &ic.Comment, &ic.Issue, backportMatches[1], versions, org, repo, num); err != nil {
return fmt.Errorf("Handle backport request failure: %w", err)
}
}
return nil
}