Repository: google/go-github
Pull request #2946 (2023-10-01 19:29:39)

Add support for "performed_via_github_app" and "requested_team" in IssueEvent
# Issue Source
#2945 mentions the reasoning for this PR.

# Why

`"performed_via_github_app"` and `"requested_team"` are valuable results in the issue events response (when available) to determine more about the event. It also keeps the struct up to date with the API response.

# What

- Adds these values to the IssueEvent struct.
- Adds test cases for added values.
- Restructures relevant test cases slightly to match the order of the given/want for easier reference.

# Other notes

Ran all available test scripts, updated accordingly. Tests passing.

google-cla[bot]: Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this [failed invocation](https://github.com/google/go-github/pull/2946/checks?check_run_id=17296055849) of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.
codecov[bot]: ## [Codecov](https://app.codecov.io/gh/google/go-github/pull/2946?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) Report
> Merging [#2946](https://app.codecov.io/gh/google/go-github/pull/2946?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) (954e7ed) into [master](https://app.codecov.io/gh/google/go-github/commit/8cd452b85e821c32eefcc5964e91e57f9731891f?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) (8cd452b) will **not change** coverage.
> The diff coverage is `n/a`.

```diff
@@           Coverage Diff           @@
##           master    #2946   +/-   ##
=======================================
  Coverage   98.19%   98.19%           
=======================================
  Files         145      145           
  Lines       12720    12720           
=======================================
  Hits        12490    12490           
  Misses        156      156           
  Partials       74       74           
```


| [Files](https://app.codecov.io/gh/google/go-github/pull/2946?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) | Coverage Δ | |
|---|---|---|
| [github/event\_types.go](https://app.codecov.io/gh/google/go-github/pull/2946?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google#diff-Z2l0aHViL2V2ZW50X3R5cGVzLmdv) | `100.00% <ø> (ø)` | |
| [github/issues\_events.go](https://app.codecov.io/gh/google/go-github/pull/2946?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google#diff-Z2l0aHViL2lzc3Vlc19ldmVudHMuZ28=) | `100.00% <ø> (ø)` | |
| [github/issues\_timeline.go](https://app.codecov.io/gh/google/go-github/pull/2946?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google#diff-Z2l0aHViL2lzc3Vlc190aW1lbGluZS5nbw==) | `100.00% <ø> (ø)` | |



Patch:
diff --git a/github/apps.go b/github/apps.go
index ab83d59a..8965e668 100644
--- a/github/apps.go
+++ b/github/apps.go
@@ -102,6 +102,15 @@ type InstallationPermissions struct {
 	Workflows                     *string `json:"workflows,omitempty"`
 }
 
+// InstallationRequest represents a pending GitHub App installation request.
+type InstallationRequest struct {
+	ID        *int64     `json:"id,omitempty"`
+	NodeID    *string    `json:"node_id,omitempty"`
+	Account   *User      `json:"account,omitempty"`
+	Requester *User      `json:"requester,omitempty"`
+	CreatedAt *Timestamp `json:"created_at,omitempty"`
+}
+
 // Installation represents a GitHub Apps installation.
 type Installation struct {
 	ID                     *int64                   `json:"id,omitempty"`
@@ -175,6 +184,29 @@ func (s *AppsService) Get(ctx context.Context, appSlug string) (*App, *Response,
 	return app, resp, nil
 }
 
+// ListInstallationRequests lists the pending installation requests that the current GitHub App has.
+//
+// GitHub API docs: https://docs.github.com/en/rest/apps/apps#list-installation-requests-for-the-authenticated-app
+func (s *AppsService) ListInstallationRequests(ctx context.Context, opts *ListOptions) ([]*InstallationRequest, *Response, error) {
+	u, err := addOptions("app/installation-requests", opts)
+	if err != nil {
+		return nil, nil, err
+	}
+
+	req, err := s.client.NewRequest("GET", u, nil)
+	if err != nil {
+		return nil, nil, err
+	}
+
+	var i []*InstallationRequest
+	resp, err := s.client.Do(ctx, req, &i)
+	if err != nil {
+		return nil, resp, err
+	}
+
+	return i, resp, nil
+}
+
 // ListInstallations lists the installations that the current GitHub App has.
 //
 // GitHub API docs: https://docs.github.com/en/rest/apps/apps#list-installations-for-the-authenticated-app
diff --git a/github/event_types.go b/github/event_types.go
index 1a403da9..3161384f 100644
--- a/github/event_types.go
+++ b/github/event_types.go
@@ -1086,6 +1086,9 @@ type PullRequestEvent struct {
 	// The following fields are only populated when the Action is "synchronize".
 	Before *string `json:"before,omitempty"`
 	After  *string `json:"after,omitempty"`
+
+	// The following will be populated if the event was performed by an App
+	PerformedViaGithubApp *App `json:"performed_via_github_app,omitempty"`
 }
 
 // PullRequestReviewEvent is triggered when a review is submitted on a pull
@@ -1186,6 +1189,9 @@ type PullRequestTargetEvent struct {
 	// The following fields are only populated when the Action is "synchronize".
 	Before *string `json:"before,omitempty"`
 	After  *string `json:"after,omitempty"`
+
+	// The following will be populated if the event was performed by an App
+	PerformedViaGithubApp *App `json:"performed_via_github_app,omitempty"`
 }
 
 // PushEvent represents a git push to a GitHub repository.
diff --git a/github/github-accessors.go b/github/github-accessors.go
index b305bfc6..73170816 100644
--- a/github/github-accessors.go
+++ b/github/github-accessors.go
@@ -8910,6 +8910,46 @@ func (i *InstallationRepositoriesEvent) GetSender() *User {
 	return i.Sender
 }
 
+// GetAccount returns the Account field.
+func (i *InstallationRequest) GetAccount() *User {
+	if i == nil {
+		return nil
+	}
+	return i.Account
+}
+
+// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise.
+func (i *InstallationRequest) GetCreatedAt() Timestamp {
+	if i == nil || i.CreatedAt == nil {
+		return Timestamp{}
+	}
+	return *i.CreatedAt
+}
+
+// GetID returns the ID field if it's non-nil, zero value otherwise.
+func (i *InstallationRequest) GetID() int64 {
+	if i == nil || i.ID == nil {
+		return 0
+	}
+	return *i.ID
+}
+
+// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise.
+func (i *InstallationRequest) GetNodeID() string {
+	if i == nil || i.NodeID == nil {
+		return ""
+	}
+	return *i.NodeID
+}
+
+// GetRequester returns the Requester field.
+func (i *InstallationRequest) GetRequester() *User {
+	if i == nil {
+		return nil
+	}
+	return i.Requester
+}
+
 // GetFrom returns the From field if it's non-nil, zero value otherwise.
 func (i *InstallationSlugChange) GetFrom() string {
 	if i == nil || i.From == nil {
@@ -9598,6 +9638,14 @@ func (i *IssueEvent) GetMilestone() *Milestone {
 	return i.Milestone
 }
 
+// GetPerformedViaGithubApp returns the PerformedViaGithubApp field.
+func (i *IssueEvent) GetPerformedViaGithubApp() *App {
+	if i == nil {
+		return nil
+	}
+	return i.PerformedViaGithubApp
+}
+
 // GetProjectCard returns the ProjectCard field.
 func (i *IssueEvent) GetProjectCard() *ProjectCard {
 	if i == nil {
@@ -9622,6 +9670,14 @@ func (i *IssueEvent) GetRequestedReviewer() *User {
 	return i.RequestedReviewer
 }
 
+// GetRequestedTeam returns the RequestedTeam field.
+func (i *IssueEvent) GetRequestedTeam() *Team {
+	if i == nil {
+		return nil
+	}
+	return i.RequestedTeam
+}
+
 // GetReviewRequester returns the ReviewRequester field.
 func (i *IssueEvent) GetReviewRequester() *User {
 	if i == nil {
@@ -16158,6 +16214,14 @@ func (p *PullRequestEvent) GetOrganization() *Organization {
 	return p.Organization
 }
 
+// GetPerformedViaGithubApp returns the PerformedViaGithubApp field.
+func (p *PullRequestEvent) GetPerformedViaGithubApp() *App {
+	if p == nil {
+		return nil
+	}
+	return p.PerformedViaGithubApp
+}
+
 // GetPullRequest returns the PullRequest field.
 func (p *PullRequestEvent) GetPullRequest() *PullRequest {
 	if p == nil {
@@ -16694,6 +16758,14 @@ func (p *PullRequestTargetEvent) GetOrganization() *Organization {
 	return p.Organization
 }
 
+// GetPerformedViaGithubApp returns the PerformedViaGithubApp field.
+func (p *PullRequestTargetEvent) GetPerformedViaGithubApp() *App {
+	if p == nil {
+		return nil
+	}
+	return p.PerformedViaGithubApp
+}
+
 // GetPullRequest returns the PullRequest field.
 func (p *PullRequestTargetEvent) GetPullRequest() *PullRequest {
 	if p == nil {
@@ -22526,6 +22598,14 @@ func (t *Timeline) GetMilestone() *Milestone {
 	return t.Milestone
 }
 
+// GetPerformedViaGithubApp returns the PerformedViaGithubApp field.
+func (t *Timeline) GetPerformedViaGithubApp() *App {
+	if t == nil {
+		return nil
+	}
+	return t.PerformedViaGithubApp
+}
+
 // GetProjectCard returns the ProjectCard field.
 func (t *Timeline) GetProjectCard() *ProjectCard {
 	if t == nil {
diff --git a/github/issues_events.go b/github/issues_events.go
index ed076591..0305fca1 100644
--- a/github/issues_events.go
+++ b/github/issues_events.go
@@ -66,7 +66,7 @@ type IssueEvent struct {
 	//
 	//    review_requested, review_request_removed
 	//       The Actor requested or removed the request for a review.
-	//       RequestedReviewer and ReviewRequester will be populated below.
+	//       RequestedReviewer or RequestedTeam, and ReviewRequester will be populated below.
 	//
 	Event *string `json:"event,omitempty"`
 
@@ -74,17 +74,19 @@ type IssueEvent struct {
 	Issue     *Issue     `json:"issue,omitempty"`
 
 	// Only present on certain events; see above.
-	Assignee          *User            `json:"assignee,omitempty"`
-	Assigner          *User            `json:"assigner,omitempty"`
-	CommitID          *string          `json:"commit_id,omitempty"`
-	Milestone         *Milestone       `json:"milestone,omitempty"`
-	Label             *Label           `json:"label,omitempty"`
-	Rename            *Rename          `json:"rename,omitempty"`
-	LockReason        *string          `json:"lock_reason,omitempty"`
-	ProjectCard       *ProjectCard     `json:"project_card,omitempty"`
-	DismissedReview   *DismissedReview `json:"dismissed_review,omitempty"`
-	RequestedReviewer *User            `json:"requested_reviewer,omitempty"`
-	ReviewRequester   *User            `json:"review_requester,omitempty"`
+	Assignee              *User            `json:"assignee,omitempty"`
+	Assigner              *User            `json:"assigner,omitempty"`
+	CommitID              *string          `json:"commit_id,omitempty"`
+	Milestone             *Milestone       `json:"milestone,omitempty"`
+	Label                 *Label           `json:"label,omitempty"`
+	Rename                *Rename          `json:"rename,omitempty"`
+	LockReason            *string          `json:"lock_reason,omitempty"`
+	ProjectCard           *ProjectCard     `json:"project_card,omitempty"`
+	DismissedReview       *DismissedReview `json:"dismissed_review,omitempty"`
+	RequestedReviewer     *User            `json:"requested_reviewer,omitempty"`
+	RequestedTeam         *Team            `json:"requested_team,omitempty"`
+	ReviewRequester       *User            `json:"review_requester,omitempty"`
+	PerformedViaGithubApp *App             `json:"performed_via_github_app,omitempty"`
 }
 
 // DismissedReview represents details for 'dismissed_review' events.
diff --git a/github/issues_timeline.go b/github/issues_timeline.go
index 9c73e617..8ac02ac1 100644
--- a/github/issues_timeline.go
+++ b/github/issues_timeline.go
@@ -151,6 +151,8 @@ type Timeline struct {
 	// The review summary text.
 	Body        *string    `json:"body,omitempty"`
 	SubmittedAt *Timestamp `json:"submitted_at,omitempty"`
+
+	PerformedViaGithubApp *App `json:"performed_via_github_app,omitempty"`
 }
 
 // Source represents a reference's source.


Test patch:
diff --git a/github/apps_test.go b/github/apps_test.go
index f87d5006..a58326ea 100644
--- a/github/apps_test.go
+++ b/github/apps_test.go
@@ -72,6 +72,53 @@ func TestAppsService_Get_specifiedApp(t *testing.T) {
 	}
 }
 
+func TestAppsService_ListInstallationRequests(t *testing.T) {
+	client, mux, _, teardown := setup()
+	defer teardown()
+
+	mux.HandleFunc("/app/installation-requests", func(w http.ResponseWriter, r *http.Request) {
+		testMethod(t, r, "GET")
+		testFormValues(t, r, values{
+			"page":     "1",
+			"per_page": "2",
+		})
+		fmt.Fprint(w, `[{
+			"id": 1,
+			"account": { "id": 2 },
+			"requester": { "id": 3 },
+			"created_at": "2018-01-01T00:00:00Z"
+		}]`,
+		)
+	})
+
+	opt := &ListOptions{Page: 1, PerPage: 2}
+	ctx := context.Background()
+	installationRequests, _, err := client.Apps.ListInstallationRequests(ctx, opt)
+	if err != nil {
+		t.Errorf("Apps.ListInstallations returned error: %v", err)
+	}
+
+	date := Timestamp{Time: time.Date(2018, time.January, 1, 0, 0, 0, 0, time.UTC)}
+	want := []*InstallationRequest{{
+		ID:        Int64(1),
+		Account:   &User{ID: Int64(2)},
+		Requester: &User{ID: Int64(3)},
+		CreatedAt: &date,
+	}}
+	if !cmp.Equal(installationRequests, want) {
+		t.Errorf("Apps.ListInstallationRequests returned %+v, want %+v", installationRequests, want)
+	}
+
+	const methodName = "ListInstallationRequests"
+	testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
+		got, resp, err := client.Apps.ListInstallationRequests(ctx, opt)
+		if got != nil {
+			t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
+		}
+		return resp, err
+	})
+}
+
 func TestAppsService_ListInstallations(t *testing.T) {
 	client, mux, _, teardown := setup()
 	defer teardown()
diff --git a/github/event_types_test.go b/github/event_types_test.go
index 31b94479..91ac2912 100644
--- a/github/event_types_test.go
+++ b/github/event_types_test.go
@@ -15177,6 +15177,15 @@ func TestPullRequestEvent_Marshal(t *testing.T) {
 			URL:  String("s"),
 			Name: String("n"),
 		},
+		PerformedViaGithubApp: &App{
+			ID:          Int64(1),
+			NodeID:      String("n"),
+			Slug:        String("s"),
+			Name:        String("n"),
+			Description: String("d"),
+			ExternalURL: String("e"),
+			HTMLURL:     String("h"),
+		},
 		Organization: &Organization{
 			BillingEmail:                         String("be"),
 			Blog:                                 String("b"),
@@ -15346,11 +15355,47 @@ func TestPullRequestEvent_Marshal(t *testing.T) {
 		"requested_team": {
 			"id": 1
 		},
+		"label": {
+			"id": 1
+		},
+		"before": "before",
+		"after": "after",
 		"repository": {
 			"id": 1,
 			"name": "n",
 			"url": "s"
 		},
+		"performed_via_github_app": {
+			"id": 1,
+			"node_id": "n",
+			"slug": "s",
+			"name": "n",
+			"description": "d",
+			"external_url": "e",
+			"html_url": "h"
+		},
+		"organization": {
+			"name": "n",
+			"company": "c",
+			"blog": "b",
+			"location": "loc",
+			"email": "e",
+			"twitter_username": "tu",
+			"description": "d",
+			"billing_email": "be",
+			"is_verified": true,
+			"has_organization_projects": true,
+			"has_repository_projects": true,
+			"default_repository_permission": "drp",
+			"members_can_create_repositories": true,
+			"members_can_create_public_repositories": false,
+			"members_can_create_private_repositories": true,
+			"members_can_create_internal_repositories": true,
+			"members_allowed_repository_creation_type": "marct",
+			"members_can_create_pages": true,
+			"members_can_create_public_pages": false,
+			"members_can_create_private_pages": true
+		},
 		"sender": {
 			"login": "l",
 			"id": 1,
@@ -15456,34 +15501,7 @@ func TestPullRequestEvent_Marshal(t *testing.T) {
 				"url": "u"
 			},
 			"suspended_at": ` + referenceTimeStr + `
-		},
-		"label": {
-			"id": 1
-		},
-		"organization": {
-			"name": "n",
-			"company": "c",
-			"blog": "b",
-			"location": "loc",
-			"email": "e",
-			"twitter_username": "tu",
-			"description": "d",
-			"billing_email": "be",
-			"is_verified": true,
-			"has_organization_projects": true,
-			"has_repository_projects": true,
-			"default_repository_permission": "drp",
-			"members_can_create_repositories": true,
-			"members_can_create_public_repositories": false,
-			"members_can_create_private_repositories": true,
-			"members_can_create_internal_repositories": true,
-			"members_allowed_repository_creation_type": "marct",
-			"members_can_create_pages": true,
-			"members_can_create_public_pages": false,
-			"members_can_create_private_pages": true
-		},
-		"before": "before",
-		"after": "after"
+		}
 	}`
 
 	testJSONMarshal(t, u, want)
@@ -16060,6 +16078,15 @@ func TestPullRequestTargetEvent_Marshal(t *testing.T) {
 			URL:  String("s"),
 			Name: String("n"),
 		},
+		PerformedViaGithubApp: &App{
+			ID:          Int64(1),
+			NodeID:      String("n"),
+			Slug:        String("s"),
+			Name:        String("n"),
+			Description: String("d"),
+			ExternalURL: String("e"),
+			HTMLURL:     String("h"),
+		},
 		Organization: &Organization{
 			BillingEmail:                         String("be"),
 			Blog:                                 String("b"),
@@ -16229,11 +16256,47 @@ func TestPullRequestTargetEvent_Marshal(t *testing.T) {
 		"requested_team": {
 			"id": 1
 		},
+		"label": {
+			"id": 1
+		},
+		"before": "before",
+		"after": "after",
 		"repository": {
 			"id": 1,
 			"name": "n",
 			"url": "s"
 		},
+		"performed_via_github_app": {
+			"id": 1,
+			"node_id": "n",
+			"slug": "s",
+			"name": "n",
+			"description": "d",
+			"external_url": "e",
+			"html_url": "h"
+		},
+		"organization": {
+			"name": "n",
+			"company": "c",
+			"blog": "b",
+			"location": "loc",
+			"email": "e",
+			"twitter_username": "tu",
+			"description": "d",
+			"billing_email": "be",
+			"is_verified": true,
+			"has_organization_projects": true,
+			"has_repository_projects": true,
+			"default_repository_permission": "drp",
+			"members_can_create_repositories": true,
+			"members_can_create_public_repositories": false,
+			"members_can_create_private_repositories": true,
+			"members_can_create_internal_repositories": true,
+			"members_allowed_repository_creation_type": "marct",
+			"members_can_create_pages": true,
+			"members_can_create_public_pages": false,
+			"members_can_create_private_pages": true
+		},
 		"sender": {
 			"login": "l",
 			"id": 1,
@@ -16339,34 +16402,7 @@ func TestPullRequestTargetEvent_Marshal(t *testing.T) {
 				"url": "u"
 			},
 			"suspended_at": ` + referenceTimeStr + `
-		},
-		"label": {
-			"id": 1
-		},
-		"organization": {
-			"name": "n",
-			"company": "c",
-			"blog": "b",
-			"location": "loc",
-			"email": "e",
-			"twitter_username": "tu",
-			"description": "d",
-			"billing_email": "be",
-			"is_verified": true,
-			"has_organization_projects": true,
-			"has_repository_projects": true,
-			"default_repository_permission": "drp",
-			"members_can_create_repositories": true,
-			"members_can_create_public_repositories": false,
-			"members_can_create_private_repositories": true,
-			"members_can_create_internal_repositories": true,
-			"members_allowed_repository_creation_type": "marct",
-			"members_can_create_pages": true,
-			"members_can_create_public_pages": false,
-			"members_can_create_private_pages": true
-		},
-		"before": "before",
-		"after": "after"
+		}
 	}`
 
 	testJSONMarshal(t, u, want)
diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go
index 962e5e8f..bdb4209a 100644
--- a/github/github-accessors_test.go
+++ b/github/github-accessors_test.go
@@ -10487,6 +10487,50 @@ func TestInstallationRepositoriesEvent_GetSender(tt *testing.T) {
 	i.GetSender()
 }
 
+func TestInstallationRequest_GetAccount(tt *testing.T) {
+	i := &InstallationRequest{}
+	i.GetAccount()
+	i = nil
+	i.GetAccount()
+}
+
+func TestInstallationRequest_GetCreatedAt(tt *testing.T) {
+	var zeroValue Timestamp
+	i := &InstallationRequest{CreatedAt: &zeroValue}
+	i.GetCreatedAt()
+	i = &InstallationRequest{}
+	i.GetCreatedAt()
+	i = nil
+	i.GetCreatedAt()
+}
+
+func TestInstallationRequest_GetID(tt *testing.T) {
+	var zeroValue int64
+	i := &InstallationRequest{ID: &zeroValue}
+	i.GetID()
+	i = &InstallationRequest{}
+	i.GetID()
+	i = nil
+	i.GetID()
+}
+
+func TestInstallationRequest_GetNodeID(tt *testing.T) {
+	var zeroValue string
+	i := &InstallationRequest{NodeID: &zeroValue}
+	i.GetNodeID()
+	i = &InstallationRequest{}
+	i.GetNodeID()
+	i = nil
+	i.GetNodeID()
+}
+
+func TestInstallationRequest_GetRequester(tt *testing.T) {
+	i := &InstallationRequest{}
+	i.GetRequester()
+	i = nil
+	i.GetRequester()
+}
+
 func TestInstallationSlugChange_GetFrom(tt *testing.T) {
 	var zeroValue string
 	i := &InstallationSlugChange{From: &zeroValue}
@@ -11248,6 +11292,13 @@ func TestIssueEvent_GetMilestone(tt *testing.T) {
 	i.GetMilestone()
 }
 
+func TestIssueEvent_GetPerformedViaGithubApp(tt *testing.T) {
+	i := &IssueEvent{}
+	i.GetPerformedViaGithubApp()
+	i = nil
+	i.GetPerformedViaGithubApp()
+}
+
 func TestIssueEvent_GetProjectCard(tt *testing.T) {
 	i := &IssueEvent{}
 	i.GetProjectCard()
@@ -11269,6 +11320,13 @@ func TestIssueEvent_GetRequestedReviewer(tt *testing.T) {
 	i.GetRequestedReviewer()
 }
 
+func TestIssueEvent_GetRequestedTeam(tt *testing.T) {
+	i := &IssueEvent{}
+	i.GetRequestedTeam()
+	i = nil
+	i.GetRequestedTeam()
+}
+
 func TestIssueEvent_GetReviewRequester(tt *testing.T) {
 	i := &IssueEvent{}
 	i.GetReviewRequester()
@@ -18812,6 +18870,13 @@ func TestPullRequestEvent_GetOrganization(tt *testing.T) {
 	p.GetOrganization()
 }
 
+func TestPullRequestEvent_GetPerformedViaGithubApp(tt *testing.T) {
+	p := &PullRequestEvent{}
+	p.GetPerformedViaGithubApp()
+	p = nil
+	p.GetPerformedViaGithubApp()
+}
+
 func TestPullRequestEvent_GetPullRequest(tt *testing.T) {
 	p := &PullRequestEvent{}
 	p.GetPullRequest()
@@ -19380,6 +19445,13 @@ func TestPullRequestTargetEvent_GetOrganization(tt *testing.T) {
 	p.GetOrganization()
 }
 
+func TestPullRequestTargetEvent_GetPerformedViaGithubApp(tt *testing.T) {
+	p := &PullRequestTargetEvent{}
+	p.GetPerformedViaGithubApp()
+	p = nil
+	p.GetPerformedViaGithubApp()
+}
+
 func TestPullRequestTargetEvent_GetPullRequest(tt *testing.T) {
 	p := &PullRequestTargetEvent{}
 	p.GetPullRequest()
@@ -26214,6 +26286,13 @@ func TestTimeline_GetMilestone(tt *testing.T) {
 	t.GetMilestone()
 }
 
+func TestTimeline_GetPerformedViaGithubApp(tt *testing.T) {
+	t := &Timeline{}
+	t.GetPerformedViaGithubApp()
+	t = nil
+	t.GetPerformedViaGithubApp()
+}
+
 func TestTimeline_GetProjectCard(tt *testing.T) {
 	t := &Timeline{}
 	t.GetProjectCard()
diff --git a/github/issues_events_test.go b/github/issues_events_test.go
index 1d8d3233..e8118b6d 100644
--- a/github/issues_events_test.go
+++ b/github/issues_events_test.go
@@ -270,6 +270,62 @@ func TestIssueEvent_Marshal(t *testing.T) {
 			CreatedAt:       &Timestamp{referenceTime},
 			SuspendedAt:     &Timestamp{referenceTime},
 		},
+		RequestedTeam: &Team{
+			ID:              Int64(1),
+			NodeID:          String("n"),
+			Name:            String("n"),
+			Description:     String("d"),
+			URL:             String("u"),
+			Slug:            String("s"),
+			Permission:      String("p"),
+			Privacy:         String("p"),
+			MembersCount:    Int(1),
+			ReposCount:      Int(1),
+			MembersURL:      String("m"),
+			RepositoriesURL: String("r"),
+			Organization: &Organization{
+				Login:     String("l"),
+				ID:        Int64(1),
+				NodeID:    String("n"),
+				AvatarURL: String("a"),
+				HTMLURL:   String("h"),
+				Name:      String("n"),
+				Company:   String("c"),
+				Blog:      String("b"),
+				Location:  String("l"),
+				Email:     String("e"),
+			},
+			Parent: &Team{
+				ID:           Int64(1),
+				NodeID:       String("n"),
+				Name:         String("n"),
+				Description:  String("d"),
+				URL:          String("u"),
+				Slug:         String("s"),
+				Permission:   String("p"),
+				Privacy:      String("p"),
+				MembersCount: Int(1),
+				ReposCount:   Int(1),
+			},
+			LDAPDN: String("l"),
+		},
+		PerformedViaGithubApp: &App{
+			ID:     Int64(1),
+			NodeID: String("n"),
+			Owner: &User{
+				Login:     String("l"),
+				ID:        Int64(1),
+				NodeID:    String("n"),
+				URL:       String("u"),
+				ReposURL:  String("r"),
+				EventsURL: String("e"),
+				AvatarURL: String("a"),
+			},
+			Name:        String("n"),
+			Description: String("d"),
+			HTMLURL:     String("h"),
+			ExternalURL: String("u"),
+		},
 		ReviewRequester: &User{
 			Login:           String("l"),
 			ID:              Int64(1),
@@ -401,6 +457,62 @@ func TestIssueEvent_Marshal(t *testing.T) {
 			"suspended_at": ` + referenceTimeStr + `,
 			"url": "u"
 		},
+		"requested_team": {
+			"id": 1,
+			"node_id": "n",
+			"name": "n",
+			"description": "d",
+			"url": "u",
+			"slug": "s",
+			"permission": "p",
+			"privacy": "p",
+			"members_count": 1,
+			"repos_count": 1,
+			"members_url": "m",
+			"repositories_url": "r",
+			"organization": {
+				"login": "l",
+				"id": 1,
+				"node_id": "n",
+				"avatar_url": "a",
+				"html_url": "h",
+				"name": "n",
+				"company": "c",
+				"blog": "b",
+				"location": "l",
+				"email": "e"
+			},
+			"parent": {
+				"id": 1,
+				"node_id": "n",
+				"name": "n",
+				"description": "d",
+				"url": "u",
+				"slug": "s",
+				"permission": "p",
+				"privacy": "p",
+				"members_count": 1,
+				"repos_count": 1
+			},
+			"ldap_dn": "l"
+		},
+		"performed_via_github_app": {
+			"id": 1,
+			"node_id": "n",
+			"owner": {
+				"login": "l",
+				"id": 1,
+				"node_id": "n",
+				"url": "u",
+				"repos_url": "r",
+				"events_url": "e",
+				"avatar_url": "a"
+			},
+			"name": "n",
+			"description": "d",
+			"html_url": "h",
+			"external_url": "u"
+		},
 		"review_requester": {
 			"login": "l",
 			"id": 1,