Skip to content

Commit

Permalink
Add support for "performed_via_github_app" and "requested_team" in Is…
Browse files Browse the repository at this point in the history
…sueEvent (#2946)

Fixes: #2495.
  • Loading branch information
Shyclyde authored Oct 3, 2023
1 parent 7d26b99 commit 5224e34
Show file tree
Hide file tree
Showing 7 changed files with 301 additions and 68 deletions.
6 changes: 6 additions & 0 deletions github/event_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
148 changes: 92 additions & 56 deletions github/event_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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"),
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down
40 changes: 40 additions & 0 deletions github/github-accessors.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 35 additions & 0 deletions github/github-accessors_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5224e34

Please sign in to comment.