Skip to content

Commit 84651d1

Browse files
authored
Add "organization" field to more events (#2949)
Fixes: #2950.
1 parent 5224e34 commit 84651d1

File tree

3 files changed

+361
-0
lines changed

3 files changed

+361
-0
lines changed

github/event_types.go

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ type CommitCommentEvent struct {
7676
Repo *Repository `json:"repository,omitempty"`
7777
Sender *User `json:"sender,omitempty"`
7878
Installation *Installation `json:"installation,omitempty"`
79+
80+
// The following field is only present when the webhook is triggered on
81+
// a repository belonging to an organization.
82+
Org *Organization `json:"organization,omitempty"`
7983
}
8084

8185
// ContentReferenceEvent is triggered when the body or comment of an issue or
@@ -132,6 +136,10 @@ type DeleteEvent struct {
132136
Repo *Repository `json:"repository,omitempty"`
133137
Sender *User `json:"sender,omitempty"`
134138
Installation *Installation `json:"installation,omitempty"`
139+
140+
// The following field is only present when the webhook is triggered on
141+
// a repository belonging to an organization.
142+
Org *Organization `json:"organization,omitempty"`
135143
}
136144

137145
// DependabotAlertEvent is triggered when there is activity relating to Dependabot alerts.
@@ -192,6 +200,10 @@ type DeploymentEvent struct {
192200
// The following fields are only populated by Webhook events.
193201
Sender *User `json:"sender,omitempty"`
194202
Installation *Installation `json:"installation,omitempty"`
203+
204+
// The following field is only present when the webhook is triggered on
205+
// a repository belonging to an organization.
206+
Org *Organization `json:"organization,omitempty"`
195207
}
196208

197209
// DeploymentProtectionRuleEvent represents a deployment protection rule event.
@@ -227,6 +239,10 @@ type DeploymentStatusEvent struct {
227239
// The following fields are only populated by Webhook events.
228240
Sender *User `json:"sender,omitempty"`
229241
Installation *Installation `json:"installation,omitempty"`
242+
243+
// The following field is only present when the webhook is triggered on
244+
// a repository belonging to an organization.
245+
Org *Organization `json:"organization,omitempty"`
230246
}
231247

232248
// DiscussionCommentEvent represents a webhook event for a comment on discussion.
@@ -363,6 +379,10 @@ type GollumEvent struct {
363379
Repo *Repository `json:"repository,omitempty"`
364380
Sender *User `json:"sender,omitempty"`
365381
Installation *Installation `json:"installation,omitempty"`
382+
383+
// The following field is only present when the webhook is triggered on
384+
// a repository belonging to an organization.
385+
Org *Organization `json:"organization,omitempty"`
366386
}
367387

368388
// EditChange represents the changes when an issue, pull request, comment,
@@ -510,6 +530,10 @@ type InstallationEvent struct {
510530
Sender *User `json:"sender,omitempty"`
511531
Installation *Installation `json:"installation,omitempty"`
512532
Requester *User `json:"requester,omitempty"`
533+
534+
// The following field is only present when the webhook is triggered on
535+
// a repository belonging to an organization.
536+
Org *Organization `json:"organization,omitempty"`
513537
}
514538

515539
// InstallationRepositoriesEvent is triggered when a repository is added or
@@ -524,6 +548,10 @@ type InstallationRepositoriesEvent struct {
524548
RepositorySelection *string `json:"repository_selection,omitempty"`
525549
Sender *User `json:"sender,omitempty"`
526550
Installation *Installation `json:"installation,omitempty"`
551+
552+
// The following field is only present when the webhook is triggered on
553+
// a repository belonging to an organization.
554+
Org *Organization `json:"organization,omitempty"`
527555
}
528556

529557
// InstallationLoginChange represents a change in login on an installation.
@@ -603,6 +631,10 @@ type IssuesEvent struct {
603631
Sender *User `json:"sender,omitempty"`
604632
Installation *Installation `json:"installation,omitempty"`
605633
Milestone *Milestone `json:"milestone,omitempty"`
634+
635+
// The following field is only present when the webhook is triggered on
636+
// a repository belonging to an organization.
637+
Org *Organization `json:"organization,omitempty"`
606638
}
607639

608640
// LabelEvent is triggered when a repository's label is created, edited, or deleted.
@@ -639,6 +671,10 @@ type MarketplacePurchaseEvent struct {
639671
PreviousMarketplacePurchase *MarketplacePurchase `json:"previous_marketplace_purchase,omitempty"`
640672
Sender *User `json:"sender,omitempty"`
641673
Installation *Installation `json:"installation,omitempty"`
674+
675+
// The following field is only present when the webhook is triggered on
676+
// a repository belonging to an organization.
677+
Org *Organization `json:"organization,omitempty"`
642678
}
643679

644680
// MemberEvent is triggered when a user is added as a collaborator to a repository.
@@ -654,6 +690,10 @@ type MemberEvent struct {
654690
Repo *Repository `json:"repository,omitempty"`
655691
Sender *User `json:"sender,omitempty"`
656692
Installation *Installation `json:"installation,omitempty"`
693+
694+
// The following field is only present when the webhook is triggered on
695+
// a repository belonging to an organization.
696+
Org *Organization `json:"organization,omitempty"`
657697
}
658698

659699
// MembershipEvent is triggered when a user is added or removed from a team.
@@ -825,6 +865,10 @@ type PageBuildEvent struct {
825865
Repo *Repository `json:"repository,omitempty"`
826866
Sender *User `json:"sender,omitempty"`
827867
Installation *Installation `json:"installation,omitempty"`
868+
869+
// The following field is only present when the webhook is triggered on
870+
// a repository belonging to an organization.
871+
Org *Organization `json:"organization,omitempty"`
828872
}
829873

830874
// PersonalAccessTokenRequestEvent occurs when there is activity relating to a
@@ -885,6 +929,10 @@ type PersonalAccessTokenRequest struct {
885929

886930
// Date and time when the associated fine-grained personal access token was last used for authentication.
887931
TokenLastUsedAt *Timestamp `json:"token_last_used_at,omitempty"`
932+
933+
// The following field is only present when the webhook is triggered on
934+
// a repository belonging to an organization.
935+
Org *Organization `json:"organization,omitempty"`
888936
}
889937

890938
// PersonalAccessTokenPermissions represents the original or newly requested
@@ -1044,6 +1092,10 @@ type PublicEvent struct {
10441092
Repo *Repository `json:"repository,omitempty"`
10451093
Sender *User `json:"sender,omitempty"`
10461094
Installation *Installation `json:"installation,omitempty"`
1095+
1096+
// The following field is only present when the webhook is triggered on
1097+
// a repository belonging to an organization.
1098+
Org *Organization `json:"organization,omitempty"`
10471099
}
10481100

10491101
// PullRequestEvent is triggered when a pull request is assigned, unassigned, labeled,
@@ -1129,6 +1181,10 @@ type PullRequestReviewCommentEvent struct {
11291181
Repo *Repository `json:"repository,omitempty"`
11301182
Sender *User `json:"sender,omitempty"`
11311183
Installation *Installation `json:"installation,omitempty"`
1184+
1185+
// The following field is only present when the webhook is triggered on
1186+
// a repository belonging to an organization.
1187+
Org *Organization `json:"organization,omitempty"`
11321188
}
11331189

11341190
// PullRequestReviewThreadEvent is triggered when a comment made as part of a
@@ -1147,6 +1203,10 @@ type PullRequestReviewThreadEvent struct {
11471203
Repo *Repository `json:"repository,omitempty"`
11481204
Sender *User `json:"sender,omitempty"`
11491205
Installation *Installation `json:"installation,omitempty"`
1206+
1207+
// The following field is only present when the webhook is triggered on
1208+
// a repository belonging to an organization.
1209+
Org *Organization `json:"organization,omitempty"`
11501210
}
11511211

11521212
// PullRequestTargetEvent is triggered when a pull request is assigned, unassigned, labeled,
@@ -1315,6 +1375,10 @@ type ReleaseEvent struct {
13151375
Repo *Repository `json:"repository,omitempty"`
13161376
Sender *User `json:"sender,omitempty"`
13171377
Installation *Installation `json:"installation,omitempty"`
1378+
1379+
// The following field is only present when the webhook is triggered on
1380+
// a repository belonging to an organization.
1381+
Org *Organization `json:"organization,omitempty"`
13181382
}
13191383

13201384
// RepositoryEvent is triggered when a repository is created, archived, unarchived,
@@ -1385,6 +1449,10 @@ type RepositoryVulnerabilityAlertEvent struct {
13851449

13861450
// The user that triggered the event.
13871451
Sender *User `json:"sender,omitempty"`
1452+
1453+
// The following field is only present when the webhook is triggered on
1454+
// a repository belonging to an organization.
1455+
Org *Organization `json:"organization,omitempty"`
13881456
}
13891457

13901458
// RepositoryVulnerabilityAlert represents a repository security alert.
@@ -1491,6 +1559,10 @@ type StatusEvent struct {
14911559
Repo *Repository `json:"repository,omitempty"`
14921560
Sender *User `json:"sender,omitempty"`
14931561
Installation *Installation `json:"installation,omitempty"`
1562+
1563+
// The following field is only present when the webhook is triggered on
1564+
// a repository belonging to an organization.
1565+
Org *Organization `json:"organization,omitempty"`
14941566
}
14951567

14961568
// TeamEvent is triggered when an organization's team is created, modified or deleted.
@@ -1561,6 +1633,10 @@ type WatchEvent struct {
15611633
Repo *Repository `json:"repository,omitempty"`
15621634
Sender *User `json:"sender,omitempty"`
15631635
Installation *Installation `json:"installation,omitempty"`
1636+
1637+
// The following field is only present when the webhook is triggered on
1638+
// a repository belonging to an organization.
1639+
Org *Organization `json:"organization,omitempty"`
15641640
}
15651641

15661642
// WorkflowDispatchEvent is triggered when someone triggers a workflow run on GitHub or

0 commit comments

Comments
 (0)