From 8dfb9cfcd7f24a4c0f269f8f3aaddcab94590103 Mon Sep 17 00:00:00 2001 From: Jean Mertz Date: Thu, 11 Jun 2015 19:17:14 +0200 Subject: [PATCH] ignore GH "push" event when ref is deleted --- pkg/remote/builtin/github/github.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/remote/builtin/github/github.go b/pkg/remote/builtin/github/github.go index 9ff0fe07..5b6fafd8 100644 --- a/pkg/remote/builtin/github/github.go +++ b/pkg/remote/builtin/github/github.go @@ -251,6 +251,10 @@ func (g *GitHub) push(r *http.Request) (*common.Hook, error) { return nil, err } + if hook.Deleted { + return nil, nil + } + repo := &common.Repo{} repo.Owner = hook.Repo.Owner.Login if len(repo.Owner) == 0 { @@ -336,7 +340,8 @@ func (g *GitHub) pullRequest(r *http.Request) (*common.Hook, error) { } type pushHook struct { - Ref string `json:"ref"` + Ref string `json:"ref"` + Deleted bool `json:"deleted"` Head struct { ID string `json:"id"`