diff --git a/main.go b/main.go index 5817836..cbcda20 100644 --- a/main.go +++ b/main.go @@ -1,3 +1,19 @@ +/* +Copyright 2022 Guilhem Lettron (guilhem@barpilot.io). + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + package main import ( @@ -5,11 +21,11 @@ import ( "context" "fmt" "os" + "regexp" "strconv" "strings" "text/template" "time" - "regexp" "github.com/google/go-github/v33/github" "golang.org/x/oauth2" @@ -24,15 +40,15 @@ import ( ) const ( - lastTimeInput = "lastTime" - labelsInput = "labels" - repoTokenInput = "repo-token" - feedInput = "feed" - prefixInput = "prefix" - aggregateInput = "aggragate" - dryRunInput = "dry-run" - titleFilterInput = "titleFilter" - contentFilterInput = "contentFilter" + lastTimeInput = "lastTime" + labelsInput = "labels" + repoTokenInput = "repo-token" + feedInput = "feed" + prefixInput = "prefix" + aggregateInput = "aggragate" + dryRunInput = "dry-run" + titleFilterInput = "titleFilter" + contentFilterInput = "contentFilter" ) func main() { @@ -118,9 +134,8 @@ func main() { content = item.Description } - filter := a.GetInput(titleFilterInput) - if filter !="" { + if filter != "" { matched, _ := regexp.MatchString(filter, item.Title) if matched { a.Debugf("No issue created due to title filter") @@ -128,7 +143,7 @@ func main() { } } filter = a.GetInput(contentFilterInput) - if filter !="" { + if filter != "" { matched, _ := regexp.MatchString(filter, content) if matched { a.Debugf("No issue created due to content filter")