Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c67c0c3

Browse filesBrowse files
authored
Add Organization to PushEvent and IssueCommentEvent (#2116)
Fixes: #2115.
1 parent 3ad22bc commit c67c0c3
Copy full SHA for c67c0c3

5 files changed

+128
-1
lines changed

‎github/event_types.go

Copy file name to clipboardExpand all lines: github/event_types.go
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,10 @@ type IssueCommentEvent struct {
384384
Repo *Repository `json:"repository,omitempty"`
385385
Sender *User `json:"sender,omitempty"`
386386
Installation *Installation `json:"installation,omitempty"`
387+
388+
// The following field is only present when the webhook is triggered on
389+
// a repository belonging to an organization.
390+
Organization *Organization `json:"organization,omitempty"`
387391
}
388392

389393
// IssuesEvent is triggered when an issue is opened, edited, deleted, transferred,
@@ -819,6 +823,10 @@ type PushEvent struct {
819823
Pusher *User `json:"pusher,omitempty"`
820824
Sender *User `json:"sender,omitempty"`
821825
Installation *Installation `json:"installation,omitempty"`
826+
827+
// The following field is only present when the webhook is triggered on
828+
// a repository belonging to an organization.
829+
Organization *Organization `json:"organization,omitempty"`
822830
}
823831

824832
func (p PushEvent) String() string {

‎github/event_types_test.go

Copy file name to clipboardExpand all lines: github/event_types_test.go
+88Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1726,6 +1726,28 @@ func TestIssueCommentEvent_Marshal(t *testing.T) {
17261726
},
17271727
SuspendedAt: &Timestamp{referenceTime},
17281728
},
1729+
Organization: &Organization{
1730+
BillingEmail: String("be"),
1731+
Blog: String("b"),
1732+
Company: String("c"),
1733+
Email: String("e"),
1734+
TwitterUsername: String("tu"),
1735+
Location: String("loc"),
1736+
Name: String("n"),
1737+
Description: String("d"),
1738+
IsVerified: Bool(true),
1739+
HasOrganizationProjects: Bool(true),
1740+
HasRepositoryProjects: Bool(true),
1741+
DefaultRepoPermission: String("drp"),
1742+
MembersCanCreateRepos: Bool(true),
1743+
MembersCanCreateInternalRepos: Bool(true),
1744+
MembersCanCreatePrivateRepos: Bool(true),
1745+
MembersCanCreatePublicRepos: Bool(false),
1746+
MembersAllowedRepositoryCreationType: String("marct"),
1747+
MembersCanCreatePages: Bool(true),
1748+
MembersCanCreatePublicPages: Bool(false),
1749+
MembersCanCreatePrivatePages: Bool(true),
1750+
},
17291751
}
17301752

17311753
want := `{
@@ -1862,6 +1884,28 @@ func TestIssueCommentEvent_Marshal(t *testing.T) {
18621884
"url": "u"
18631885
},
18641886
"suspended_at": ` + referenceTimeStr + `
1887+
},
1888+
"organization": {
1889+
"name": "n",
1890+
"company": "c",
1891+
"blog": "b",
1892+
"location": "loc",
1893+
"email": "e",
1894+
"twitter_username": "tu",
1895+
"description": "d",
1896+
"billing_email": "be",
1897+
"is_verified": true,
1898+
"has_organization_projects": true,
1899+
"has_repository_projects": true,
1900+
"default_repository_permission": "drp",
1901+
"members_can_create_repositories": true,
1902+
"members_can_create_public_repositories": false,
1903+
"members_can_create_private_repositories": true,
1904+
"members_can_create_internal_repositories": true,
1905+
"members_allowed_repository_creation_type": "marct",
1906+
"members_can_create_pages": true,
1907+
"members_can_create_public_pages": false,
1908+
"members_can_create_private_pages": true
18651909
}
18661910
}`
18671911

@@ -3410,6 +3454,28 @@ func TestPushEvent_Marshal(t *testing.T) {
34103454
},
34113455
SuspendedAt: &Timestamp{referenceTime},
34123456
},
3457+
Organization: &Organization{
3458+
BillingEmail: String("be"),
3459+
Blog: String("b"),
3460+
Company: String("c"),
3461+
Email: String("e"),
3462+
TwitterUsername: String("tu"),
3463+
Location: String("loc"),
3464+
Name: String("n"),
3465+
Description: String("d"),
3466+
IsVerified: Bool(true),
3467+
HasOrganizationProjects: Bool(true),
3468+
HasRepositoryProjects: Bool(true),
3469+
DefaultRepoPermission: String("drp"),
3470+
MembersCanCreateRepos: Bool(true),
3471+
MembersCanCreateInternalRepos: Bool(true),
3472+
MembersCanCreatePrivateRepos: Bool(true),
3473+
MembersCanCreatePublicRepos: Bool(false),
3474+
MembersAllowedRepositoryCreationType: String("marct"),
3475+
MembersCanCreatePages: Bool(true),
3476+
MembersCanCreatePublicPages: Bool(false),
3477+
MembersCanCreatePrivatePages: Bool(true),
3478+
},
34133479
}
34143480

34153481
want := `{
@@ -3550,6 +3616,28 @@ func TestPushEvent_Marshal(t *testing.T) {
35503616
"url": "u"
35513617
},
35523618
"suspended_at": ` + referenceTimeStr + `
3619+
},
3620+
"organization": {
3621+
"name": "n",
3622+
"company": "c",
3623+
"blog": "b",
3624+
"location": "loc",
3625+
"email": "e",
3626+
"twitter_username": "tu",
3627+
"description": "d",
3628+
"billing_email": "be",
3629+
"is_verified": true,
3630+
"has_organization_projects": true,
3631+
"has_repository_projects": true,
3632+
"default_repository_permission": "drp",
3633+
"members_can_create_repositories": true,
3634+
"members_can_create_public_repositories": false,
3635+
"members_can_create_private_repositories": true,
3636+
"members_can_create_internal_repositories": true,
3637+
"members_allowed_repository_creation_type": "marct",
3638+
"members_can_create_pages": true,
3639+
"members_can_create_public_pages": false,
3640+
"members_can_create_private_pages": true
35533641
}
35543642
}`
35553643

‎github/github-accessors.go

Copy file name to clipboardExpand all lines: github/github-accessors.go
+16Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎github/github-accessors_test.go

Copy file name to clipboardExpand all lines: github/github-accessors_test.go
+14Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎github/github-stringify_test.go

Copy file name to clipboardExpand all lines: github/github-stringify_test.go
+2-1Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.