Repository: google/go-github (go)

Issue:
Webhook payload fields for Github Apps: action, organization and installation
Each webhook event payload contains properties unique to the event. There are a few common keys for these properties: `action`, `sender`, `repository`, `organization`, `installation`.
more details: [Webhook payload object common properties](https://docs.github.com/en/free-pro-team@latest/developers/webhooks-and-events/webhook-events-and-payloads#webhook-payload-object-common-properties).

`WebHookPayload` struct doesn't contain `action`, `organization` and `installation` fields yet, but these objects need for webhooks from Github App.

Can I add these objects to `WebHookPayload`?

Pull request description:
Add action, organization and installation objects to Webhook payload
Fixes #1674.

Patch:
diff --git a/github/github-accessors.go b/github/github-accessors.go
index 4e08cf81..6d4d1737 100644
--- a/github/github-accessors.go
+++ b/github/github-accessors.go
@@ -14940,6 +14940,14 @@ func (w *WebHookCommit) GetTimestamp() time.Time {
 	return *w.Timestamp
 }
 
+// GetAction returns the Action field if it's non-nil, zero value otherwise.
+func (w *WebHookPayload) GetAction() string {
+	if w == nil || w.Action == nil {
+		return ""
+	}
+	return *w.Action
+}
+
 // GetAfter returns the After field if it's non-nil, zero value otherwise.
 func (w *WebHookPayload) GetAfter() string {
 	if w == nil || w.After == nil {
@@ -14996,6 +15004,22 @@ func (w *WebHookPayload) GetHeadCommit() *WebHookCommit {
 	return w.HeadCommit
 }
 
+// GetInstallation returns the Installation field.
+func (w *WebHookPayload) GetInstallation() *Installation {
+	if w == nil {
+		return nil
+	}
+	return w.Installation
+}
+
+// GetOrganization returns the Organization field.
+func (w *WebHookPayload) GetOrganization() *Organization {
+	if w == nil {
+		return nil
+	}
+	return w.Organization
+}
+
 // GetPusher returns the Pusher field.
 func (w *WebHookPayload) GetPusher() *User {
 	if w == nil {
diff --git a/github/repos_hooks.go b/github/repos_hooks.go
index 5e0aafae..b82c6e14 100644
--- a/github/repos_hooks.go
+++ b/github/repos_hooks.go
@@ -19,18 +19,21 @@ import (
 //
 // GitHub API docs: https://help.github.com/articles/post-receive-hooks
 type WebHookPayload struct {
-	After      *string          `json:"after,omitempty"`
-	Before     *string          `json:"before,omitempty"`
-	Commits    []*WebHookCommit `json:"commits,omitempty"`
-	Compare    *string          `json:"compare,omitempty"`
-	Created    *bool            `json:"created,omitempty"`
-	Deleted    *bool            `json:"deleted,omitempty"`
-	Forced     *bool            `json:"forced,omitempty"`
-	HeadCommit *WebHookCommit   `json:"head_commit,omitempty"`
-	Pusher     *User            `json:"pusher,omitempty"`
-	Ref        *string          `json:"ref,omitempty"`
-	Repo       *Repository      `json:"repository,omitempty"`
-	Sender     *User            `json:"sender,omitempty"`
+	Action       *string          `json:"action,omitempty"`
+	After        *string          `json:"after,omitempty"`
+	Before       *string          `json:"before,omitempty"`
+	Commits      []*WebHookCommit `json:"commits,omitempty"`
+	Compare      *string          `json:"compare,omitempty"`
+	Created      *bool            `json:"created,omitempty"`
+	Deleted      *bool            `json:"deleted,omitempty"`
+	Forced       *bool            `json:"forced,omitempty"`
+	HeadCommit   *WebHookCommit   `json:"head_commit,omitempty"`
+	Installation *Installation    `json:"installation,omitempty"`
+	Organization *Organization    `json:"organization,omitempty"`
+	Pusher       *User            `json:"pusher,omitempty"`
+	Ref          *string          `json:"ref,omitempty"`
+	Repo         *Repository      `json:"repository,omitempty"`
+	Sender       *User            `json:"sender,omitempty"`
 }
 
 func (w WebHookPayload) String() string {


Test patch:
diff --git a/github/github-stringify_test.go b/github/github-stringify_test.go
index f586ca8d..2113453f 100644
--- a/github/github-stringify_test.go
+++ b/github/github-stringify_test.go
@@ -1781,19 +1781,22 @@ func TestWebHookCommit_String(t *testing.T) {
 
 func TestWebHookPayload_String(t *testing.T) {
 	v := WebHookPayload{
-		After:      String(""),
-		Before:     String(""),
-		Compare:    String(""),
-		Created:    Bool(false),
-		Deleted:    Bool(false),
-		Forced:     Bool(false),
-		HeadCommit: &WebHookCommit{},
-		Pusher:     &User{},
-		Ref:        String(""),
-		Repo:       &Repository{},
-		Sender:     &User{},
-	}
-	want := `github.WebHookPayload{After:"", Before:"", Compare:"", Created:false, Deleted:false, Forced:false, HeadCommit:github.WebHookCommit{}, Pusher:github.User{}, Ref:"", Repo:github.Repository{}, Sender:github.User{}}`
+		Action:       String(""),
+		After:        String(""),
+		Before:       String(""),
+		Compare:      String(""),
+		Created:      Bool(false),
+		Deleted:      Bool(false),
+		Forced:       Bool(false),
+		HeadCommit:   &WebHookCommit{},
+		Installation: &Installation{},
+		Organization: &Organization{},
+		Pusher:       &User{},
+		Ref:          String(""),
+		Repo:         &Repository{},
+		Sender:       &User{},
+	}
+	want := `github.WebHookPayload{Action:"", After:"", Before:"", Compare:"", Created:false, Deleted:false, Forced:false, HeadCommit:github.WebHookCommit{}, Installation:github.Installation{}, Organization:github.Organization{}, Pusher:github.User{}, Ref:"", Repo:github.Repository{}, Sender:github.User{}}`
 	if got := v.String(); got != want {
 		t.Errorf("WebHookPayload.String = %v, want %v", got, want)
 	}