Skip to content

Commit

Permalink
Add "organization" field to more events (#2949)
Browse files Browse the repository at this point in the history
Fixes: #2950.
  • Loading branch information
billnapier committed Oct 4, 2023
1 parent 5224e34 commit 84651d1
Show file tree
Hide file tree
Showing 3 changed files with 361 additions and 0 deletions.
76 changes: 76 additions & 0 deletions github/event_types.go
Expand Up @@ -76,6 +76,10 @@ type CommitCommentEvent struct {
Repo *Repository `json:"repository,omitempty"`
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`

// The following field is only present when the webhook is triggered on
// a repository belonging to an organization.
Org *Organization `json:"organization,omitempty"`
}

// ContentReferenceEvent is triggered when the body or comment of an issue or
Expand Down Expand Up @@ -132,6 +136,10 @@ type DeleteEvent struct {
Repo *Repository `json:"repository,omitempty"`
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`

// The following field is only present when the webhook is triggered on
// a repository belonging to an organization.
Org *Organization `json:"organization,omitempty"`
}

// DependabotAlertEvent is triggered when there is activity relating to Dependabot alerts.
Expand Down Expand Up @@ -192,6 +200,10 @@ type DeploymentEvent struct {
// The following fields are only populated by Webhook events.
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`

// The following field is only present when the webhook is triggered on
// a repository belonging to an organization.
Org *Organization `json:"organization,omitempty"`
}

// DeploymentProtectionRuleEvent represents a deployment protection rule event.
Expand Down Expand Up @@ -227,6 +239,10 @@ type DeploymentStatusEvent struct {
// The following fields are only populated by Webhook events.
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`

// The following field is only present when the webhook is triggered on
// a repository belonging to an organization.
Org *Organization `json:"organization,omitempty"`
}

// DiscussionCommentEvent represents a webhook event for a comment on discussion.
Expand Down Expand Up @@ -363,6 +379,10 @@ type GollumEvent struct {
Repo *Repository `json:"repository,omitempty"`
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`

// The following field is only present when the webhook is triggered on
// a repository belonging to an organization.
Org *Organization `json:"organization,omitempty"`
}

// EditChange represents the changes when an issue, pull request, comment,
Expand Down Expand Up @@ -510,6 +530,10 @@ type InstallationEvent struct {
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`
Requester *User `json:"requester,omitempty"`

// The following field is only present when the webhook is triggered on
// a repository belonging to an organization.
Org *Organization `json:"organization,omitempty"`
}

// InstallationRepositoriesEvent is triggered when a repository is added or
Expand All @@ -524,6 +548,10 @@ type InstallationRepositoriesEvent struct {
RepositorySelection *string `json:"repository_selection,omitempty"`
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`

// The following field is only present when the webhook is triggered on
// a repository belonging to an organization.
Org *Organization `json:"organization,omitempty"`
}

// InstallationLoginChange represents a change in login on an installation.
Expand Down Expand Up @@ -603,6 +631,10 @@ type IssuesEvent struct {
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`
Milestone *Milestone `json:"milestone,omitempty"`

// The following field is only present when the webhook is triggered on
// a repository belonging to an organization.
Org *Organization `json:"organization,omitempty"`
}

// LabelEvent is triggered when a repository's label is created, edited, or deleted.
Expand Down Expand Up @@ -639,6 +671,10 @@ type MarketplacePurchaseEvent struct {
PreviousMarketplacePurchase *MarketplacePurchase `json:"previous_marketplace_purchase,omitempty"`
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`

// The following field is only present when the webhook is triggered on
// a repository belonging to an organization.
Org *Organization `json:"organization,omitempty"`
}

// MemberEvent is triggered when a user is added as a collaborator to a repository.
Expand All @@ -654,6 +690,10 @@ type MemberEvent struct {
Repo *Repository `json:"repository,omitempty"`
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`

// The following field is only present when the webhook is triggered on
// a repository belonging to an organization.
Org *Organization `json:"organization,omitempty"`
}

// MembershipEvent is triggered when a user is added or removed from a team.
Expand Down Expand Up @@ -825,6 +865,10 @@ type PageBuildEvent struct {
Repo *Repository `json:"repository,omitempty"`
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`

// The following field is only present when the webhook is triggered on
// a repository belonging to an organization.
Org *Organization `json:"organization,omitempty"`
}

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

// Date and time when the associated fine-grained personal access token was last used for authentication.
TokenLastUsedAt *Timestamp `json:"token_last_used_at,omitempty"`

// The following field is only present when the webhook is triggered on
// a repository belonging to an organization.
Org *Organization `json:"organization,omitempty"`
}

// PersonalAccessTokenPermissions represents the original or newly requested
Expand Down Expand Up @@ -1044,6 +1092,10 @@ type PublicEvent struct {
Repo *Repository `json:"repository,omitempty"`
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`

// The following field is only present when the webhook is triggered on
// a repository belonging to an organization.
Org *Organization `json:"organization,omitempty"`
}

// PullRequestEvent is triggered when a pull request is assigned, unassigned, labeled,
Expand Down Expand Up @@ -1129,6 +1181,10 @@ type PullRequestReviewCommentEvent struct {
Repo *Repository `json:"repository,omitempty"`
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`

// The following field is only present when the webhook is triggered on
// a repository belonging to an organization.
Org *Organization `json:"organization,omitempty"`
}

// PullRequestReviewThreadEvent is triggered when a comment made as part of a
Expand All @@ -1147,6 +1203,10 @@ type PullRequestReviewThreadEvent struct {
Repo *Repository `json:"repository,omitempty"`
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`

// The following field is only present when the webhook is triggered on
// a repository belonging to an organization.
Org *Organization `json:"organization,omitempty"`
}

// PullRequestTargetEvent is triggered when a pull request is assigned, unassigned, labeled,
Expand Down Expand Up @@ -1315,6 +1375,10 @@ type ReleaseEvent struct {
Repo *Repository `json:"repository,omitempty"`
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`

// The following field is only present when the webhook is triggered on
// a repository belonging to an organization.
Org *Organization `json:"organization,omitempty"`
}

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

// The user that triggered the event.
Sender *User `json:"sender,omitempty"`

// The following field is only present when the webhook is triggered on
// a repository belonging to an organization.
Org *Organization `json:"organization,omitempty"`
}

// RepositoryVulnerabilityAlert represents a repository security alert.
Expand Down Expand Up @@ -1491,6 +1559,10 @@ type StatusEvent struct {
Repo *Repository `json:"repository,omitempty"`
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`

// The following field is only present when the webhook is triggered on
// a repository belonging to an organization.
Org *Organization `json:"organization,omitempty"`
}

// TeamEvent is triggered when an organization's team is created, modified or deleted.
Expand Down Expand Up @@ -1561,6 +1633,10 @@ type WatchEvent struct {
Repo *Repository `json:"repository,omitempty"`
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`

// The following field is only present when the webhook is triggered on
// a repository belonging to an organization.
Org *Organization `json:"organization,omitempty"`
}

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

0 comments on commit 84651d1

Please sign in to comment.