Skip to content

Commit

Permalink
Handle package webhook (google#1569)
Browse files Browse the repository at this point in the history
Fixes: google#1550.
  • Loading branch information
KrammerJake authored Jul 8, 2020
1 parent 3a60410 commit 0b152f6
Show file tree
Hide file tree
Showing 7 changed files with 695 additions and 0 deletions.
2 changes: 2 additions & 0 deletions github/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ func (e *Event) ParsePayload() (payload interface{}, err error) {
payload = &OrganizationEvent{}
case "OrgBlockEvent":
payload = &OrgBlockEvent{}
case "PackageEvent":
payload = &PackageEvent{}
case "PageBuildEvent":
payload = &PageBuildEvent{}
case "PingEvent":
Expand Down
16 changes: 16 additions & 0 deletions github/event_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,22 @@ type OrgBlockEvent struct {
Installation *Installation `json:"installation,omitempty"`
}

// PackageEvent represents activity related to GitHub Packages.
// The Webhook event name is "package".
//
// This event is triggered when a GitHub Package is published or updated.
//
// GitHub API docs: https://developer.github.com/webhooks/event-payloads/#package
type PackageEvent struct {
// Action is the action that was performed.
// Can be "published" or "updated".
Action *string `json:"action,omitempty"`
Package *Package `json:"package,omitempty"`
Repo *Repository `json:"repository,omitempty"`
Org *Organization `json:"organization,omitempty"`
Sender *User `json:"sender,omitempty"`
}

// PageBuildEvent represents an attempted build of a GitHub Pages site, whether
// successful or not.
// The Webhook event name is "page_build".
Expand Down
Loading

0 comments on commit 0b152f6

Please sign in to comment.