Skip to content

Commit d173fe3

Browse files
dominicgunngmlewis
authored andcommitted
Fix Webhook creation. (#1117)
1 parent e810655 commit d173fe3

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

github/repos_hooks.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ func (h Hook) String() string {
9292
// information.
9393
type createHookRequest struct {
9494
// Config is required.
95+
Name string `json:"name"`
9596
Config map[string]interface{} `json:"config,omitempty"`
9697
Events []string `json:"events,omitempty"`
9798
Active *bool `json:"active,omitempty"`
@@ -108,6 +109,7 @@ func (s *RepositoriesService) CreateHook(ctx context.Context, owner, repo string
108109
u := fmt.Sprintf("repos/%v/%v/hooks", owner, repo)
109110

110111
hookReq := &createHookRequest{
112+
Name: "web",
111113
Events: hook.Events,
112114
Active: hook.Active,
113115
Config: hook.Config,

github/repos_hooks_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func TestRepositoriesService_CreateHook(t *testing.T) {
2525
json.NewDecoder(r.Body).Decode(v)
2626

2727
testMethod(t, r, "POST")
28-
want := &createHookRequest{}
28+
want := &createHookRequest{Name: "web"}
2929
if !reflect.DeepEqual(v, want) {
3030
t.Errorf("Request body = %+v, want %+v", v, want)
3131
}

0 commit comments

Comments
 (0)