ignore GH "push" event when ref is deleted

This commit is contained in:
Jean Mertz 2015-06-11 19:17:14 +02:00
parent c59d02a64c
commit 8dfb9cfcd7

View file

@ -251,6 +251,10 @@ func (g *GitHub) push(r *http.Request) (*common.Hook, error) {
return nil, err return nil, err
} }
if hook.Deleted {
return nil, nil
}
repo := &common.Repo{} repo := &common.Repo{}
repo.Owner = hook.Repo.Owner.Login repo.Owner = hook.Repo.Owner.Login
if len(repo.Owner) == 0 { if len(repo.Owner) == 0 {
@ -336,7 +340,8 @@ func (g *GitHub) pullRequest(r *http.Request) (*common.Hook, error) {
} }
type pushHook struct { type pushHook struct {
Ref string `json:"ref"` Ref string `json:"ref"`
Deleted bool `json:"deleted"`
Head struct { Head struct {
ID string `json:"id"` ID string `json:"id"`