mirror of
https://github.com/outbackdingo/ghorg.git
synced 2026-01-27 18:18:58 +00:00
* fix: emit warning for filtering by topics for Bitbucket * feat: add support for filtering topics for GitLab * fix: reset GHORG_TOPICS env var between tests Co-authored-by: Schafhauser, David <david.schafhauser@siemens.com>
26 lines
496 B
Go
26 lines
496 B
Go
package scm
|
|
|
|
import (
|
|
"os"
|
|
"strings"
|
|
)
|
|
|
|
func hasMatchingTopic(rpTopics []string) bool {
|
|
envTopics := strings.Split(os.Getenv("GHORG_TOPICS"), ",")
|
|
|
|
// If user defined a list of topics, check if any match with this repo
|
|
if os.Getenv("GHORG_TOPICS") != "" {
|
|
for _, rpTopic := range rpTopics {
|
|
for _, envTopic := range envTopics {
|
|
if rpTopic == envTopic {
|
|
return true
|
|
}
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
// If no user defined topics are specified, accept any topics
|
|
return true
|
|
}
|