diff --git a/github/activity_events.go b/github/activity_events.go index 6bf38b4..0fd850e 100644 --- a/github/activity_events.go +++ b/github/activity_events.go @@ -55,10 +55,14 @@ func (e *Event) Payload() (payload interface{}) { payload = &IssueCommentEvent{} case "IssuesEvent": payload = &IssuesEvent{} + case "LabelEvent": + payload = &LabelEvent{} case "MemberEvent": payload = &MemberEvent{} case "MembershipEvent": payload = &MembershipEvent{} + case "MilestoneEvent": + payload = &MilestoneEvent{} case "PageBuildEvent": payload = &PageBuildEvent{} case "PublicEvent": diff --git a/github/event_types.go b/github/event_types.go index 16f89b0..3abe1ef 100644 --- a/github/event_types.go +++ b/github/event_types.go @@ -209,6 +209,22 @@ type IssuesEvent struct { Sender *User `json:"sender,omitempty"` } +// LabelEvent is triggered when a repository's label is created, edited, or deleted. +// The Webhook event name is "label" +// +// GitHub docs: https://developer.github.com/v3/activity/events/types/#labelevent +type LabelEvent struct { + // Action is the action that was performed. Possible values are: + // "created", "edited", "deleted" + Action *string `json:"action,omitempty"` + Label *Label `json:"label,omitempty"` + + // The following fields are only populated by Webhook events. + Changes *EditChange `json:"changes,omitempty"` + Repo *Repository `json:"repository,omitempty"` + Org *Organization `json:"organization,omitempty"` +} + // MemberEvent is triggered when a user is added as a collaborator to a repository. // The Webhook event name is "member". // @@ -243,6 +259,23 @@ type MembershipEvent struct { Sender *User `json:"sender,omitempty"` } +// MilestoneEvent is triggered when a milestone is created, closed, opened, edited, or deleted. +// The Webhook event name is "milestone". +// +// Github docs: https://developer.github.com/v3/activity/events/types/#milestoneevent +type MilestoneEvent struct { + // Action is the action that was performed. Possible values are: + // "created", "closed", "opened", "edited", "deleted" + Action *string `json:"action,omitempty"` + Milestone *Milestone `json:"milestone,omitempty"` + + // The following fields are only populated by Webhook events. + Changes *EditChange `json:"changes,omitempty"` + Repo *Repository `json:"repository,omitempty"` + Sender *User `json:"sender,omitempty"` + Org *Organization `json:"organization,omitempty"` +} + // PageBuildEvent represents an attempted build of a GitHub Pages site, whether // successful or not. // The Webhook event name is "page_build". diff --git a/github/messages.go b/github/messages.go index eedb190..810e9fd 100644 --- a/github/messages.go +++ b/github/messages.go @@ -49,8 +49,10 @@ var ( "integration_installation_repositories": "IntegrationInstallationRepositoriesEvent", "issue_comment": "IssueCommentEvent", "issues": "IssuesEvent", + "label": "LabelEvent", "member": "MemberEvent", "membership": "MembershipEvent", + "milestone": "MilestoneEvent", "page_build": "PageBuildEvent", "public": "PublicEvent", "pull_request_review_comment": "PullRequestReviewCommentEvent", diff --git a/github/messages_test.go b/github/messages_test.go index 1686f26..327adf5 100644 --- a/github/messages_test.go +++ b/github/messages_test.go @@ -124,6 +124,10 @@ func TestParseWebHook(t *testing.T) { payload: &IssuesEvent{}, messageType: "issues", }, + { + payload: &LabelEvent{}, + messageType: "label", + }, { payload: &MemberEvent{}, messageType: "member", @@ -132,6 +136,10 @@ func TestParseWebHook(t *testing.T) { payload: &MembershipEvent{}, messageType: "membership", }, + { + payload: &MilestoneEvent{}, + messageType: "milestone", + }, { payload: &PageBuildEvent{}, messageType: "page_build",