From 6f8aa8f2539bea6d6fcaa7659c0bb8bf4495d3f6 Mon Sep 17 00:00:00 2001 From: "Helmut K. C. Tessarek" Date: Tue, 23 Apr 2019 17:22:36 -0400 Subject: [PATCH] improve test for 'update' label The test for an update is too specific. It misses several cases: update PORT to NNN PORT: update MAINPORT to NNN, SUBPORT to NNN Some people might want to use the type `- [x] update` in the body. --- pr/webhook/pull_request.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pr/webhook/pull_request.go b/pr/webhook/pull_request.go index c3e5cc9..55a7b83 100644 --- a/pr/webhook/pull_request.go +++ b/pr/webhook/pull_request.go @@ -174,13 +174,13 @@ func (receiver *Receiver) processPullRequest(event *github.PullRequestEvent) { if isSubmission { typeLabels = appendIfUnique(typeLabels, "type: submission") } - if strings.Contains(strings.ToLower(*event.PullRequest.Title), ": update to") { + if strings.Contains(strings.ToLower(*event.PullRequest.Title), ": update") || strings.HasPrefix(strings.ToLower(*event.PullRequest.Title), "update") { typeLabels = appendIfUnique(typeLabels, "type: update") } if cveRegexp.FindString(*event.PullRequest.Title) != "" || cveRegexp.FindString(*event.PullRequest.Body) != "" { typeLabels = appendIfUnique(typeLabels, "type: security fix") } - typesFromBody := []string{"bugfix", "enhancement", "security fix"} + typesFromBody := []string{"bugfix", "enhancement", "security fix", "update"} for _, t := range typesFromBody { if strings.Contains(*event.PullRequest.Body, "[x] "+t) { typeLabels = appendIfUnique(typeLabels, "type: "+t)