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.
This commit is contained in:
Helmut K. C. Tessarek
2019-04-25 02:56:07 +00:00
committed by Zero King
parent bb29ea01f7
commit 6f8aa8f253
+2 -2
View File
@@ -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)