git: don't show empty changeset

This commit is contained in:
Chris Sexton 2019-11-03 08:06:26 -05:00 committed by Chris Sexton
parent d1149e7022
commit 97ca444df9
1 changed files with 4 additions and 0 deletions

View File

@ -36,6 +36,10 @@ 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 := ""
if len(push.Commits) == 0 {
log.Debug().Msg("GitHub sent an empty changeset")
return
}
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 pushed to %s (<%s|%s>) %s\n", commits += fmt.Sprintf("%s pushed to %s (<%s|%s>) %s\n",