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 "organization" field to more events #2949

Merged
merged 6 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
76 changes: 76 additions & 0 deletions github/event_types.go
Original file line number Diff line number Diff line change
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.
Organization *Organization `json:"organization,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's please name them all Org.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left the existing ones, as I wasn't sure if you wanted a breaking change here or not. Happy to go change them all if you don't mind the breakage.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, sorry! That will teach me to do code reviews on my Android phone. 😂

Hmmm... consistency is nice as long as we document our changes.

Sure, let's be consistent and I'll mark this as a breaking API change. 😁

Copy link
Collaborator

@gmlewis gmlewis Oct 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm... I'm no longer on my phone, and I'm not understanding this statement:

I left the existing ones, as I wasn't sure if you wanted a breaking change here or not. Happy to go change them all if you don't mind the breakage.

I don't see any existing organization fields in any of the structs you modified, so I don't think this is a breaking API change afterall, correct?

}

// 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.
Organization *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.
Organization *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.
Organization *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.
Organization *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.
Organization *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.
Organization *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.
Organization *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.
Organization *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.
Organization *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.
Organization *Organization `json:"organization,omitempty"`
}

// PullRequestEvent is triggered when a pull request is assigned, unassigned, labeled,
Expand Down Expand Up @@ -1126,6 +1178,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.
Organization *Organization `json:"organization,omitempty"`
}

// PullRequestReviewThreadEvent is triggered when a comment made as part of a
Expand All @@ -1144,6 +1200,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.
Organization *Organization `json:"organization,omitempty"`
}

// PullRequestTargetEvent is triggered when a pull request is assigned, unassigned, labeled,
Expand Down Expand Up @@ -1309,6 +1369,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.
Organization *Organization `json:"organization,omitempty"`
}

// RepositoryEvent is triggered when a repository is created, archived, unarchived,
Expand Down Expand Up @@ -1379,6 +1443,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.
Organization *Organization `json:"organization,omitempty"`
}

// RepositoryVulnerabilityAlert represents a repository security alert.
Expand Down Expand Up @@ -1485,6 +1553,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.
Organization *Organization `json:"organization,omitempty"`
}

// TeamEvent is triggered when an organization's team is created, modified or deleted.
Expand Down Expand Up @@ -1555,6 +1627,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.
Organization *Organization `json:"organization,omitempty"`
}

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