Skip to content

Commit

Permalink
Merge pull request #18 from grafana/more-verbose-output
Browse files Browse the repository at this point in the history
more verbose output
  • Loading branch information
replay authored Apr 25, 2024
2 parents 78c22d5 + 432c4bc commit 74008a6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/labeler/labeler.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,18 @@ func (l *Labeler) Run(issue *github.Issue) error {
}

func (l *Labeler) findLabel(title, body string) (label string, err error) {
// Don't log title / body because they might contain sensitive data.

scoreByLabel := make(map[string]int)
for label, properties := range l.cfg.Labels {
level.Info(l.logger).Log("msg", "evaluating regular expressions for label", "label", label)

for _, matcher := range properties.Matchers {
if matcher.regex.MatchString(title) || matcher.regex.MatchString(body) {
level.Info(l.logger).Log("msg", "regex matches", "regex", matcher.RegexStr)
level.Info(l.logger).Log("msg", "regex matches", "regex", matcher.RegexStr, "weight", matcher.Weight)
scoreByLabel[label] += matcher.Weight
} else {
level.Info(l.logger).Log("msg", "regex does not match", "regex", matcher.RegexStr)
}
}
}
Expand Down

0 comments on commit 74008a6

Please sign in to comment.