mirror of https://github.com/velour/catbase.git
github: convert filter to array
This commit is contained in:
parent
6cf2437cfb
commit
7b98da6286
|
@ -38,15 +38,18 @@ func (p *GitPlugin) githubEvent(w http.ResponseWriter, r *http.Request) {
|
||||||
repo = push.Repository.Name
|
repo = push.Repository.Name
|
||||||
owner = push.Repository.Owner.Login
|
owner = push.Repository.Owner.Login
|
||||||
commits := ""
|
commits := ""
|
||||||
filterBranch := p.c.Get(fmt.Sprintf("github.%s.%s.branches", owner, repo), "*")
|
filterBranches := p.c.GetArray(fmt.Sprintf("github.%s.%s.branches", owner, repo), []string{"*"})
|
||||||
if len(push.Commits) == 0 {
|
if len(push.Commits) == 0 {
|
||||||
log.Debug().Msg("GitHub sent an empty changeset")
|
log.Debug().Msg("GitHub sent an empty changeset")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if filterBranch != "*" && !strings.Contains(push.Ref, filterBranch) {
|
for _, filterBranch := range filterBranches {
|
||||||
log.Debug().Msgf("Ignoring GitHub push to %s", push.Ref)
|
if filterBranch == "*" || strings.Contains(push.Ref, filterBranch) {
|
||||||
return
|
goto processBranch
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
processBranch:
|
||||||
for _, c := range push.Commits {
|
for _, c := range push.Commits {
|
||||||
m := strings.Split(c.Message, "\n")[0]
|
m := strings.Split(c.Message, "\n")[0]
|
||||||
commits += fmt.Sprintf("%s %s pushed to %s (<%s|%s>) %s\n",
|
commits += fmt.Sprintf("%s %s pushed to %s (<%s|%s>) %s\n",
|
||||||
|
|
Loading…
Reference in New Issue