From 8e91d28a56f4218027a3e2d1f8d1b1de4c87b971 Mon Sep 17 00:00:00 2001 From: Dominic Gunn Date: Mon, 11 Feb 2019 16:08:46 +0000 Subject: [PATCH 1/4] Webhook name now seems to be required --- github/repos_hooks.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/github/repos_hooks.go b/github/repos_hooks.go index 43f706870d7..7d3b192d842 100644 --- a/github/repos_hooks.go +++ b/github/repos_hooks.go @@ -92,6 +92,7 @@ func (h Hook) String() string { // information. type createHookRequest struct { // Config is required. + Name string `json:"name,omitempty"` Config map[string]interface{} `json:"config,omitempty"` Events []string `json:"events,omitempty"` Active *bool `json:"active,omitempty"` @@ -108,6 +109,7 @@ func (s *RepositoriesService) CreateHook(ctx context.Context, owner, repo string u := fmt.Sprintf("repos/%v/%v/hooks", owner, repo) hookReq := &createHookRequest{ + Name: "web", Events: hook.Events, Active: hook.Active, Config: hook.Config, From 9ece90536e69e96e62d479bb5e8456c81590af5e Mon Sep 17 00:00:00 2001 From: Dominic Gunn Date: Mon, 11 Feb 2019 16:20:53 +0000 Subject: [PATCH 2/4] Fix hook test --- github/repos_hooks_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/repos_hooks_test.go b/github/repos_hooks_test.go index 1ab287ed104..37a68223c57 100644 --- a/github/repos_hooks_test.go +++ b/github/repos_hooks_test.go @@ -25,7 +25,7 @@ func TestRepositoriesService_CreateHook(t *testing.T) { json.NewDecoder(r.Body).Decode(v) testMethod(t, r, "POST") - want := &createHookRequest{} + want := &createHookRequest{Name: "web"} if !reflect.DeepEqual(v, want) { t.Errorf("Request body = %+v, want %+v", v, want) } From c561c57a1685263e5412dd9e0a3a5f7a3c8ff044 Mon Sep 17 00:00:00 2001 From: Dominic Gunn Date: Mon, 11 Feb 2019 16:38:32 +0000 Subject: [PATCH 3/4] gofmt --- github/repos_hooks.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/repos_hooks.go b/github/repos_hooks.go index 7d3b192d842..42ab4fae398 100644 --- a/github/repos_hooks.go +++ b/github/repos_hooks.go @@ -109,7 +109,7 @@ func (s *RepositoriesService) CreateHook(ctx context.Context, owner, repo string u := fmt.Sprintf("repos/%v/%v/hooks", owner, repo) hookReq := &createHookRequest{ - Name: "web", + Name: "web", Events: hook.Events, Active: hook.Active, Config: hook.Config, From 3747f66059ea403481d0fd923b139e4c54b5ffd3 Mon Sep 17 00:00:00 2001 From: Dominic Gunn Date: Wed, 27 Feb 2019 09:23:27 +0000 Subject: [PATCH 4/4] Remove omitempty as per request. --- github/repos_hooks.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/repos_hooks.go b/github/repos_hooks.go index 42ab4fae398..14aab2c63b5 100644 --- a/github/repos_hooks.go +++ b/github/repos_hooks.go @@ -92,7 +92,7 @@ func (h Hook) String() string { // information. type createHookRequest struct { // Config is required. - Name string `json:"name,omitempty"` + Name string `json:"name"` Config map[string]interface{} `json:"config,omitempty"` Events []string `json:"events,omitempty"` Active *bool `json:"active,omitempty"`