Repository: google/go-github
Pull request #2322 (2022-03-25 03:39:05)

Update workflow to use Go 1.18 and Go 1.17

codecov[bot]: # [Codecov](https://codecov.io/gh/google/go-github/pull/2322?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) Report
> Merging [#2322](https://codecov.io/gh/google/go-github/pull/2322?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) (2844dcb) into [master](https://codecov.io/gh/google/go-github/commit/3e8a7f0fbe0e4402f9ad5a80e0ab0a050786e0f8?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) (3e8a7f0) will **not change** coverage.
> The diff coverage is `n/a`.

```diff
@@           Coverage Diff           @@
##           master    #2322   +/-   ##
=======================================
  Coverage   98.04%   98.04%           
=======================================
  Files         117      117           
  Lines       10460    10460           
=======================================
  Hits        10256    10256           
  Misses        140      140           
  Partials       64       64           
```



------

[Continue to review full report at Codecov](https://codecov.io/gh/google/go-github/pull/2322?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/google/go-github/pull/2322?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google). Last update [3e8a7f0...2844dcb](https://codecov.io/gh/google/go-github/pull/2322?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google).

gmlewis: Awaiting LGTM+Approval from any contributor on this repo before merging.

Patch:
diff --git a/github/event_types.go b/github/event_types.go
index de729c06..71baac88 100644
--- a/github/event_types.go
+++ b/github/event_types.go
@@ -885,6 +885,7 @@ type PushEvent struct {
 	DistinctSize *int          `json:"distinct_size,omitempty"`
 
 	// The following fields are only populated by Webhook events.
+	Action       *string              `json:"action,omitempty"`
 	After        *string              `json:"after,omitempty"`
 	Created      *bool                `json:"created,omitempty"`
 	Deleted      *bool                `json:"deleted,omitempty"`
diff --git a/github/gen-accessors.go b/github/gen-accessors.go
index 58ac3eb1..d8136d2c 100644
--- a/github/gen-accessors.go
+++ b/github/gen-accessors.go
@@ -186,10 +186,18 @@ func (t *templateData) dump() error {
 		}
 
 		logf("Writing %v...", filename)
-		if err := ioutil.WriteFile(filename, clean, 0644); err != nil {
+		if err := os.Chmod(filename, 0644); err != nil {
+			return fmt.Errorf("os.Chmod(%q, 0644): %v", filename, err)
+		}
+
+		if err := ioutil.WriteFile(filename, clean, 0444); err != nil {
 			return err
 		}
 
+		if err := os.Chmod(filename, 0444); err != nil {
+			return fmt.Errorf("os.Chmod(%q, 0444): %v", filename, err)
+		}
+
 		return nil
 	}
 
@@ -329,6 +337,8 @@ const source = `// Copyright {{.Year}} The go-github AUTHORS. All rights reserve
 // license that can be found in the LICENSE file.
 
 // Code generated by gen-accessors; DO NOT EDIT.
+// Instead, please run "go generate ./..." as described here:
+// https://github.com/google/go-github/blob/master/CONTRIBUTING.md#submitting-a-patch
 
 package {{.Package}}
 {{with .Imports}}
@@ -373,6 +383,8 @@ const test = `// Copyright {{.Year}} The go-github AUTHORS. All rights reserved.
 // license that can be found in the LICENSE file.
 
 // Code generated by gen-accessors; DO NOT EDIT.
+// Instead, please run "go generate ./..." as described here:
+// https://github.com/google/go-github/blob/master/CONTRIBUTING.md#submitting-a-patch
 
 package {{.Package}}
 {{with .Imports}}
diff --git a/github/github-accessors.go b/github/github-accessors.go
index cad631db..67bd7b92 100644
--- a/github/github-accessors.go
+++ b/github/github-accessors.go
@@ -4,6 +4,8 @@
 // license that can be found in the LICENSE file.
 
 // Code generated by gen-accessors; DO NOT EDIT.
+// Instead, please run "go generate ./..." as described here:
+// https://github.com/google/go-github/blob/master/CONTRIBUTING.md#submitting-a-patch
 
 package github
 
@@ -12988,6 +12990,14 @@ func (p *PunchCard) GetHour() int {
 	return *p.Hour
 }
 
+// GetAction returns the Action field if it's non-nil, zero value otherwise.
+func (p *PushEvent) GetAction() string {
+	if p == nil || p.Action == nil {
+		return ""
+	}
+	return *p.Action
+}
+
 // GetAfter returns the After field if it's non-nil, zero value otherwise.
 func (p *PushEvent) GetAfter() string {
 	if p == nil || p.After == nil {
@@ -19028,190 +19038,6 @@ func (w *WatchEvent) GetSender() *User {
 	return w.Sender
 }
 
-// GetEmail returns the Email field if it's non-nil, zero value otherwise.
-func (w *WebHookAuthor) GetEmail() string {
-	if w == nil || w.Email == nil {
-		return ""
-	}
-	return *w.Email
-}
-
-// GetName returns the Name field if it's non-nil, zero value otherwise.
-func (w *WebHookAuthor) GetName() string {
-	if w == nil || w.Name == nil {
-		return ""
-	}
-	return *w.Name
-}
-
-// GetUsername returns the Username field if it's non-nil, zero value otherwise.
-func (w *WebHookAuthor) GetUsername() string {
-	if w == nil || w.Username == nil {
-		return ""
-	}
-	return *w.Username
-}
-
-// GetAuthor returns the Author field.
-func (w *WebHookCommit) GetAuthor() *WebHookAuthor {
-	if w == nil {
-		return nil
-	}
-	return w.Author
-}
-
-// GetCommitter returns the Committer field.
-func (w *WebHookCommit) GetCommitter() *WebHookAuthor {
-	if w == nil {
-		return nil
-	}
-	return w.Committer
-}
-
-// GetDistinct returns the Distinct field if it's non-nil, zero value otherwise.
-func (w *WebHookCommit) GetDistinct() bool {
-	if w == nil || w.Distinct == nil {
-		return false
-	}
-	return *w.Distinct
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (w *WebHookCommit) GetID() string {
-	if w == nil || w.ID == nil {
-		return ""
-	}
-	return *w.ID
-}
-
-// GetMessage returns the Message field if it's non-nil, zero value otherwise.
-func (w *WebHookCommit) GetMessage() string {
-	if w == nil || w.Message == nil {
-		return ""
-	}
-	return *w.Message
-}
-
-// GetTimestamp returns the Timestamp field if it's non-nil, zero value otherwise.
-func (w *WebHookCommit) GetTimestamp() time.Time {
-	if w == nil || w.Timestamp == nil {
-		return 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 {
-		return ""
-	}
-	return *w.After
-}
-
-// GetBefore returns the Before field if it's non-nil, zero value otherwise.
-func (w *WebHookPayload) GetBefore() string {
-	if w == nil || w.Before == nil {
-		return ""
-	}
-	return *w.Before
-}
-
-// GetCompare returns the Compare field if it's non-nil, zero value otherwise.
-func (w *WebHookPayload) GetCompare() string {
-	if w == nil || w.Compare == nil {
-		return ""
-	}
-	return *w.Compare
-}
-
-// GetCreated returns the Created field if it's non-nil, zero value otherwise.
-func (w *WebHookPayload) GetCreated() bool {
-	if w == nil || w.Created == nil {
-		return false
-	}
-	return *w.Created
-}
-
-// GetDeleted returns the Deleted field if it's non-nil, zero value otherwise.
-func (w *WebHookPayload) GetDeleted() bool {
-	if w == nil || w.Deleted == nil {
-		return false
-	}
-	return *w.Deleted
-}
-
-// GetForced returns the Forced field if it's non-nil, zero value otherwise.
-func (w *WebHookPayload) GetForced() bool {
-	if w == nil || w.Forced == nil {
-		return false
-	}
-	return *w.Forced
-}
-
-// GetHeadCommit returns the HeadCommit field.
-func (w *WebHookPayload) GetHeadCommit() *WebHookCommit {
-	if w == nil {
-		return nil
-	}
-	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 {
-		return nil
-	}
-	return w.Pusher
-}
-
-// GetRef returns the Ref field if it's non-nil, zero value otherwise.
-func (w *WebHookPayload) GetRef() string {
-	if w == nil || w.Ref == nil {
-		return ""
-	}
-	return *w.Ref
-}
-
-// GetRepo returns the Repo field.
-func (w *WebHookPayload) GetRepo() *Repository {
-	if w == nil {
-		return nil
-	}
-	return w.Repo
-}
-
-// GetSender returns the Sender field.
-func (w *WebHookPayload) GetSender() *User {
-	if w == nil {
-		return nil
-	}
-	return w.Sender
-}
-
 // GetTotal returns the Total field if it's non-nil, zero value otherwise.
 func (w *WeeklyCommitActivity) GetTotal() int {
 	if w == nil || w.Total == nil {
diff --git a/github/repos_hooks.go b/github/repos_hooks.go
index 6afec860..61c85219 100644
--- a/github/repos_hooks.go
+++ b/github/repos_hooks.go
@@ -18,57 +18,22 @@ import (
 // here to account for these differences.
 //
 // GitHub API docs: https://help.github.com/articles/post-receive-hooks
-type WebHookPayload struct {
-	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 {
-	return Stringify(w)
-}
+//
+// Deprecated: Please use PushEvent instead.
+type WebHookPayload = PushEvent
 
 // WebHookCommit represents the commit variant we receive from GitHub in a
 // WebHookPayload.
-type WebHookCommit struct {
-	Added     []string       `json:"added,omitempty"`
-	Author    *WebHookAuthor `json:"author,omitempty"`
-	Committer *WebHookAuthor `json:"committer,omitempty"`
-	Distinct  *bool          `json:"distinct,omitempty"`
-	ID        *string        `json:"id,omitempty"`
-	Message   *string        `json:"message,omitempty"`
-	Modified  []string       `json:"modified,omitempty"`
-	Removed   []string       `json:"removed,omitempty"`
-	Timestamp *time.Time     `json:"timestamp,omitempty"`
-}
-
-func (w WebHookCommit) String() string {
-	return Stringify(w)
-}
+//
+// Deprecated: Please use HeadCommit instead.
+type WebHookCommit = HeadCommit
 
 // WebHookAuthor represents the author or committer of a commit, as specified
 // in a WebHookCommit. The commit author may not correspond to a GitHub User.
-type WebHookAuthor struct {
-	Email    *string `json:"email,omitempty"`
-	Name     *string `json:"name,omitempty"`
-	Username *string `json:"username,omitempty"`
-}
-
-func (w WebHookAuthor) String() string {
-	return Stringify(w)
-}
+//
+// Deprecated: Please use CommitAuthor instead.
+// NOTE Breaking API change: the `Username` field is now called `Login`.
+type WebHookAuthor = CommitAuthor
 
 // Hook represents a GitHub (web and service) hook for a repository.
 type Hook struct {


Test patch:
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 0045ad4b..c51af971 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -14,7 +14,7 @@ jobs:
   test:
     strategy:
       matrix:
-        go-version: [1.x, 1.16.x]
+        go-version: [1.x, 1.17.x]
         platform: [ubuntu-latest]
         include:
           # include windows, but only with the latest Go version, since there
diff --git a/github/gen-stringify-test.go b/github/gen-stringify-test.go
index b78edad9..71783fe5 100644
--- a/github/gen-stringify-test.go
+++ b/github/gen-stringify-test.go
@@ -352,7 +352,19 @@ func (t *templateData) dump() error {
 	}
 
 	logf("Writing %v...", t.filename)
-	return ioutil.WriteFile(t.filename, clean, 0644)
+	if err := os.Chmod(t.filename, 0644); err != nil {
+		return fmt.Errorf("os.Chmod(%q, 0644): %v", t.filename, err)
+	}
+
+	if err := ioutil.WriteFile(t.filename, clean, 0444); err != nil {
+		return err
+	}
+
+	if err := os.Chmod(t.filename, 0444); err != nil {
+		return fmt.Errorf("os.Chmod(%q, 0444): %v", t.filename, err)
+	}
+
+	return nil
 }
 
 func newStructField(receiverType, fieldName, fieldType, zeroValue string, namedStruct bool) *structField {
@@ -379,6 +391,8 @@ const source = `// Copyright {{.Year}} The go-github AUTHORS. All rights reserve
 // license that can be found in the LICENSE file.
 
 // Code generated by gen-stringify-tests; DO NOT EDIT.
+// Instead, please run "go generate ./..." as described here:
+// https://github.com/google/go-github/blob/master/CONTRIBUTING.md#submitting-a-patch
 
 package {{ $package := .Package}}{{$package}}
 {{with .Imports}}
diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go
index a796fe05..54b24108 100644
--- a/github/github-accessors_test.go
+++ b/github/github-accessors_test.go
@@ -4,6 +4,8 @@
 // license that can be found in the LICENSE file.
 
 // Code generated by gen-accessors; DO NOT EDIT.
+// Instead, please run "go generate ./..." as described here:
+// https://github.com/google/go-github/blob/master/CONTRIBUTING.md#submitting-a-patch
 
 package github
 
@@ -15108,6 +15110,16 @@ func TestPunchCard_GetHour(tt *testing.T) {
 	p.GetHour()
 }
 
+func TestPushEvent_GetAction(tt *testing.T) {
+	var zeroValue string
+	p := &PushEvent{Action: &zeroValue}
+	p.GetAction()
+	p = &PushEvent{}
+	p.GetAction()
+	p = nil
+	p.GetAction()
+}
+
 func TestPushEvent_GetAfter(tt *testing.T) {
 	var zeroValue string
 	p := &PushEvent{After: &zeroValue}
@@ -22280,212 +22292,6 @@ func TestWatchEvent_GetSender(tt *testing.T) {
 	w.GetSender()
 }
 
-func TestWebHookAuthor_GetEmail(tt *testing.T) {
-	var zeroValue string
-	w := &WebHookAuthor{Email: &zeroValue}
-	w.GetEmail()
-	w = &WebHookAuthor{}
-	w.GetEmail()
-	w = nil
-	w.GetEmail()
-}
-
-func TestWebHookAuthor_GetName(tt *testing.T) {
-	var zeroValue string
-	w := &WebHookAuthor{Name: &zeroValue}
-	w.GetName()
-	w = &WebHookAuthor{}
-	w.GetName()
-	w = nil
-	w.GetName()
-}
-
-func TestWebHookAuthor_GetUsername(tt *testing.T) {
-	var zeroValue string
-	w := &WebHookAuthor{Username: &zeroValue}
-	w.GetUsername()
-	w = &WebHookAuthor{}
-	w.GetUsername()
-	w = nil
-	w.GetUsername()
-}
-
-func TestWebHookCommit_GetAuthor(tt *testing.T) {
-	w := &WebHookCommit{}
-	w.GetAuthor()
-	w = nil
-	w.GetAuthor()
-}
-
-func TestWebHookCommit_GetCommitter(tt *testing.T) {
-	w := &WebHookCommit{}
-	w.GetCommitter()
-	w = nil
-	w.GetCommitter()
-}
-
-func TestWebHookCommit_GetDistinct(tt *testing.T) {
-	var zeroValue bool
-	w := &WebHookCommit{Distinct: &zeroValue}
-	w.GetDistinct()
-	w = &WebHookCommit{}
-	w.GetDistinct()
-	w = nil
-	w.GetDistinct()
-}
-
-func TestWebHookCommit_GetID(tt *testing.T) {
-	var zeroValue string
-	w := &WebHookCommit{ID: &zeroValue}
-	w.GetID()
-	w = &WebHookCommit{}
-	w.GetID()
-	w = nil
-	w.GetID()
-}
-
-func TestWebHookCommit_GetMessage(tt *testing.T) {
-	var zeroValue string
-	w := &WebHookCommit{Message: &zeroValue}
-	w.GetMessage()
-	w = &WebHookCommit{}
-	w.GetMessage()
-	w = nil
-	w.GetMessage()
-}
-
-func TestWebHookCommit_GetTimestamp(tt *testing.T) {
-	var zeroValue time.Time
-	w := &WebHookCommit{Timestamp: &zeroValue}
-	w.GetTimestamp()
-	w = &WebHookCommit{}
-	w.GetTimestamp()
-	w = nil
-	w.GetTimestamp()
-}
-
-func TestWebHookPayload_GetAction(tt *testing.T) {
-	var zeroValue string
-	w := &WebHookPayload{Action: &zeroValue}
-	w.GetAction()
-	w = &WebHookPayload{}
-	w.GetAction()
-	w = nil
-	w.GetAction()
-}
-
-func TestWebHookPayload_GetAfter(tt *testing.T) {
-	var zeroValue string
-	w := &WebHookPayload{After: &zeroValue}
-	w.GetAfter()
-	w = &WebHookPayload{}
-	w.GetAfter()
-	w = nil
-	w.GetAfter()
-}
-
-func TestWebHookPayload_GetBefore(tt *testing.T) {
-	var zeroValue string
-	w := &WebHookPayload{Before: &zeroValue}
-	w.GetBefore()
-	w = &WebHookPayload{}
-	w.GetBefore()
-	w = nil
-	w.GetBefore()
-}
-
-func TestWebHookPayload_GetCompare(tt *testing.T) {
-	var zeroValue string
-	w := &WebHookPayload{Compare: &zeroValue}
-	w.GetCompare()
-	w = &WebHookPayload{}
-	w.GetCompare()
-	w = nil
-	w.GetCompare()
-}
-
-func TestWebHookPayload_GetCreated(tt *testing.T) {
-	var zeroValue bool
-	w := &WebHookPayload{Created: &zeroValue}
-	w.GetCreated()
-	w = &WebHookPayload{}
-	w.GetCreated()
-	w = nil
-	w.GetCreated()
-}
-
-func TestWebHookPayload_GetDeleted(tt *testing.T) {
-	var zeroValue bool
-	w := &WebHookPayload{Deleted: &zeroValue}
-	w.GetDeleted()
-	w = &WebHookPayload{}
-	w.GetDeleted()
-	w = nil
-	w.GetDeleted()
-}
-
-func TestWebHookPayload_GetForced(tt *testing.T) {
-	var zeroValue bool
-	w := &WebHookPayload{Forced: &zeroValue}
-	w.GetForced()
-	w = &WebHookPayload{}
-	w.GetForced()
-	w = nil
-	w.GetForced()
-}
-
-func TestWebHookPayload_GetHeadCommit(tt *testing.T) {
-	w := &WebHookPayload{}
-	w.GetHeadCommit()
-	w = nil
-	w.GetHeadCommit()
-}
-
-func TestWebHookPayload_GetInstallation(tt *testing.T) {
-	w := &WebHookPayload{}
-	w.GetInstallation()
-	w = nil
-	w.GetInstallation()
-}
-
-func TestWebHookPayload_GetOrganization(tt *testing.T) {
-	w := &WebHookPayload{}
-	w.GetOrganization()
-	w = nil
-	w.GetOrganization()
-}
-
-func TestWebHookPayload_GetPusher(tt *testing.T) {
-	w := &WebHookPayload{}
-	w.GetPusher()
-	w = nil
-	w.GetPusher()
-}
-
-func TestWebHookPayload_GetRef(tt *testing.T) {
-	var zeroValue string
-	w := &WebHookPayload{Ref: &zeroValue}
-	w.GetRef()
-	w = &WebHookPayload{}
-	w.GetRef()
-	w = nil
-	w.GetRef()
-}
-
-func TestWebHookPayload_GetRepo(tt *testing.T) {
-	w := &WebHookPayload{}
-	w.GetRepo()
-	w = nil
-	w.GetRepo()
-}
-
-func TestWebHookPayload_GetSender(tt *testing.T) {
-	w := &WebHookPayload{}
-	w.GetSender()
-	w = nil
-	w.GetSender()
-}
-
 func TestWeeklyCommitActivity_GetTotal(tt *testing.T) {
 	var zeroValue int
 	w := &WeeklyCommitActivity{Total: &zeroValue}
diff --git a/github/github-stringify_test.go b/github/github-stringify_test.go
index 26cfd82c..9e04a01b 100644
--- a/github/github-stringify_test.go
+++ b/github/github-stringify_test.go
@@ -4,6 +4,8 @@
 // license that can be found in the LICENSE file.
 
 // Code generated by gen-stringify-tests; DO NOT EDIT.
+// Instead, please run "go generate ./..." as described here:
+// https://github.com/google/go-github/blob/master/CONTRIBUTING.md#submitting-a-patch
 
 package github
 
@@ -1341,6 +1343,7 @@ func TestPushEvent_String(t *testing.T) {
 		Size:         Int(0),
 		Before:       String(""),
 		DistinctSize: Int(0),
+		Action:       String(""),
 		After:        String(""),
 		Created:      Bool(false),
 		Deleted:      Bool(false),
@@ -1354,7 +1357,7 @@ func TestPushEvent_String(t *testing.T) {
 		Installation: &Installation{},
 		Organization: &Organization{},
 	}
-	want := `github.PushEvent{PushID:0, Head:"", Ref:"", Size:0, Before:"", DistinctSize:0, After:"", Created:false, Deleted:false, Forced:false, BaseRef:"", Compare:"", Repo:github.PushEventRepository{}, HeadCommit:github.HeadCommit{}, Pusher:github.User{}, Sender:github.User{}, Installation:github.Installation{}, Organization:github.Organization{}}`
+	want := `github.PushEvent{PushID:0, Head:"", Ref:"", Size:0, Before:"", DistinctSize:0, Action:"", After:"", Created:false, Deleted:false, Forced:false, BaseRef:"", Compare:"", Repo:github.PushEventRepository{}, HeadCommit:github.HeadCommit{}, Pusher:github.User{}, Sender:github.User{}, Installation:github.Installation{}, Organization:github.Organization{}}`
 	if got := v.String(); got != want {
 		t.Errorf("PushEvent.String = %v, want %v", got, want)
 	}
@@ -1951,58 +1954,6 @@ func TestUserStats_String(t *testing.T) {
 	}
 }
 
-func TestWebHookAuthor_String(t *testing.T) {
-	v := WebHookAuthor{
-		Email:    String(""),
-		Name:     String(""),
-		Username: String(""),
-	}
-	want := `github.WebHookAuthor{Email:"", Name:"", Username:""}`
-	if got := v.String(); got != want {
-		t.Errorf("WebHookAuthor.String = %v, want %v", got, want)
-	}
-}
-
-func TestWebHookCommit_String(t *testing.T) {
-	v := WebHookCommit{
-		Added:     []string{""},
-		Author:    &WebHookAuthor{},
-		Committer: &WebHookAuthor{},
-		Distinct:  Bool(false),
-		ID:        String(""),
-		Message:   String(""),
-		Modified:  []string{""},
-		Removed:   []string{""},
-	}
-	want := `github.WebHookCommit{Added:[""], Author:github.WebHookAuthor{}, Committer:github.WebHookAuthor{}, Distinct:false, ID:"", Message:"", Modified:[""], Removed:[""]}`
-	if got := v.String(); got != want {
-		t.Errorf("WebHookCommit.String = %v, want %v", got, want)
-	}
-}
-
-func TestWebHookPayload_String(t *testing.T) {
-	v := WebHookPayload{
-		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)
-	}
-}
-
 func TestWeeklyCommitActivity_String(t *testing.T) {
 	v := WeeklyCommitActivity{
 		Days:  []int{0},
diff --git a/github/repos_hooks_test.go b/github/repos_hooks_test.go
index 3137bf49..50dad9c2 100644
--- a/github/repos_hooks_test.go
+++ b/github/repos_hooks_test.go
@@ -316,14 +316,14 @@ func TestBranchWebHookPayload_Marshal(t *testing.T) {
 			{
 				Added: []string{"1", "2", "3"},
 				Author: &WebHookAuthor{
-					Email:    String("abc@gmail.com"),
-					Name:     String("abc"),
-					Username: String("abc_12"),
+					Email: String("abc@gmail.com"),
+					Name:  String("abc"),
+					Login: String("abc_12"),
 				},
 				Committer: &WebHookAuthor{
-					Email:    String("abc@gmail.com"),
-					Name:     String("abc"),
-					Username: String("abc_12"),
+					Email: String("abc@gmail.com"),
+					Name:  String("abc"),
+					Login: String("abc_12"),
 				},
 				ID:       String("1"),
 				Message:  String("WebHookCommit"),
@@ -337,14 +337,14 @@ func TestBranchWebHookPayload_Marshal(t *testing.T) {
 		HeadCommit: &WebHookCommit{
 			Added: []string{"1", "2", "3"},
 			Author: &WebHookAuthor{
-				Email:    String("abc@gmail.com"),
-				Name:     String("abc"),
-				Username: String("abc_12"),
+				Email: String("abc@gmail.com"),
+				Name:  String("abc"),
+				Login: String("abc_12"),
 			},
 			Committer: &WebHookAuthor{
-				Email:    String("abc@gmail.com"),
-				Name:     String("abc"),
-				Username: String("abc_12"),
+				Email: String("abc@gmail.com"),
+				Name:  String("abc"),
+				Login: String("abc_12"),
 			},
 			ID:       String("1"),
 			Message:  String("WebHookCommit"),
@@ -361,7 +361,7 @@ func TestBranchWebHookPayload_Marshal(t *testing.T) {
 			Login: String("rd@yahoo.com"),
 			ID:    Int64(112),
 		},
-		Repo: &Repository{
+		Repo: &PushEventRepository{
 			ID:     Int64(321),
 			NodeID: String("node_321"),
 		},
@@ -441,9 +441,9 @@ func TestBranchWebHookAuthor_Marshal(t *testing.T) {
 	testJSONMarshal(t, &WebHookAuthor{}, "{}")
 
 	v := &WebHookAuthor{
-		Email:    String("abc@gmail.com"),
-		Name:     String("abc"),
-		Username: String("abc_12"),
+		Email: String("abc@gmail.com"),
+		Name:  String("abc"),
+		Login: String("abc_12"),
 	}
 
 	want := `{
@@ -461,14 +461,14 @@ func TestBranchWebHookCommit_Marshal(t *testing.T) {
 	v := &WebHookCommit{
 		Added: []string{"1", "2", "3"},
 		Author: &WebHookAuthor{
-			Email:    String("abc@gmail.com"),
-			Name:     String("abc"),
-			Username: String("abc_12"),
+			Email: String("abc@gmail.com"),
+			Name:  String("abc"),
+			Login: String("abc_12"),
 		},
 		Committer: &WebHookAuthor{
-			Email:    String("abc@gmail.com"),
-			Name:     String("abc"),
-			Username: String("abc_12"),
+			Email: String("abc@gmail.com"),
+			Name:  String("abc"),
+			Login: String("abc_12"),
 		},
 		ID:       String("1"),
 		Message:  String("WebHookCommit"),
diff --git a/github/strings_test.go b/github/strings_test.go
index 83cb231b..10074f08 100644
--- a/github/strings_test.go
+++ b/github/strings_test.go
@@ -127,9 +127,9 @@ func TestString(t *testing.T) {
 		{TreeEntry{SHA: String("s")}, `github.TreeEntry{SHA:"s"}`},
 		{Tree{SHA: String("s")}, `github.Tree{SHA:"s"}`},
 		{User{ID: Int64(1)}, `github.User{ID:1}`},
-		{WebHookAuthor{Name: String("n")}, `github.WebHookAuthor{Name:"n"}`},
-		{WebHookCommit{ID: String("1")}, `github.WebHookCommit{ID:"1"}`},
-		{WebHookPayload{Ref: String("r")}, `github.WebHookPayload{Ref:"r"}`},
+		{WebHookAuthor{Name: String("n")}, `github.CommitAuthor{Name:"n"}`},
+		{WebHookCommit{ID: String("1")}, `github.HeadCommit{ID:"1"}`},
+		{WebHookPayload{Ref: String("r")}, `github.PushEvent{Ref:"r"}`},
 	}
 
 	for i, tt := range tests {