+
Skip to content

Handle package webhook #1569

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

Merged
merged 3 commits into from
Jul 8, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
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"`
Comment on lines +482 to +483

Choose a reason for hiding this comment

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

Use full names here? Repository and Organization instead of Repo and Org. For the sake of consistency.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This file does have mixed naming conventions where both the full name and shorthand are used; however, the shorthand (Repo and Org) versions appear to be the more popular names in this file. I think we can leave these the way they are unless we're trying to standardize to the full name going forward.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, we have not been totally consistent in this regard, so I didn't comment on these. I think that these are the two names we regularly allow to be shortened, as they are globally well known throughout the package and have very small chance of ever causing conflicts with new JSON tags that might show up in later releases.

I'm fine with leaving them as Repo and Org.

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
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载