Skip to content

Commit 19e593b

Browse files
committed
Add missing common event fields.
See https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#webhook-payload-object-common-properties for the list of common fields. I may have missed some - but gives better coverage for fields we were missing before. Signed-off-by: Billy Lynch <billy@chainguard.dev>
1 parent 3072c0a commit 19e593b

File tree

3 files changed

+123
-5
lines changed

3 files changed

+123
-5
lines changed

github/event_types.go

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,11 @@ type CreateEvent struct {
106106
RefType *string `json:"ref_type,omitempty"`
107107
MasterBranch *string `json:"master_branch,omitempty"`
108108
Description *string `json:"description,omitempty"`
109+
PusherType *string `json:"pusher_type,omitempty"`
109110

110111
// The following fields are only populated by Webhook events.
111-
PusherType *string `json:"pusher_type,omitempty"`
112112
Repo *Repository `json:"repository,omitempty"`
113+
Org *Organization `json:"organization,omitempty"`
113114
Sender *User `json:"sender,omitempty"`
114115
Installation *Installation `json:"installation,omitempty"`
115116
}
@@ -493,13 +494,14 @@ type IssuesEvent struct {
493494
type LabelEvent struct {
494495
// Action is the action that was performed. Possible values are:
495496
// "created", "edited", "deleted"
496-
Action *string `json:"action,omitempty"`
497-
Label *Label `json:"label,omitempty"`
497+
Action *string `json:"action,omitempty"`
498+
Label *Label `json:"label,omitempty"`
499+
Changes *EditChange `json:"changes,omitempty"`
498500

499501
// The following fields are only populated by Webhook events.
500-
Changes *EditChange `json:"changes,omitempty"`
501502
Repo *Repository `json:"repository,omitempty"`
502503
Org *Organization `json:"organization,omitempty"`
504+
Sender *User `json:"sender,omitempty"`
503505
Installation *Installation `json:"installation,omitempty"`
504506
}
505507

@@ -574,6 +576,9 @@ type MetaEvent struct {
574576
Hook *Hook `json:"hook,omitempty"`
575577

576578
// The following fields are only populated by Webhook events.
579+
Repo *Repository `json:"repository,omitempty"`
580+
Org *Organization `json:"organization,omitempty"`
581+
Sender *User `json:"sender,omitempty"`
577582
Installation *Installation `json:"installation,omitempty"`
578583
}
579584

@@ -682,7 +687,12 @@ type PingEvent struct {
682687
// The ID of the webhook that triggered the ping.
683688
HookID *int64 `json:"hook_id,omitempty"`
684689
// The webhook configuration.
685-
Hook *Hook `json:"hook,omitempty"`
690+
Hook *Hook `json:"hook,omitempty"`
691+
692+
// The following fields are only populated by Webhook events.
693+
Repo *Repository `json:"repository,omitempty"`
694+
Org *Organization `json:"organization,omitempty"`
695+
Sender *User `json:"sender,omitempty"`
686696
Installation *Installation `json:"installation,omitempty"`
687697
}
688698

github/github-accessors.go

Lines changed: 56 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

Lines changed: 52 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)