Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for "performed_via_github_app" and "requested_team" in IssueEvent #2946

Merged
merged 3 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading