diff options
Diffstat (limited to 'models/webhook/webhook.go')
-rw-r--r-- | models/webhook/webhook.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/models/webhook/webhook.go b/models/webhook/webhook.go index d61d1ed642..941a3f15c7 100644 --- a/models/webhook/webhook.go +++ b/models/webhook/webhook.go @@ -134,6 +134,7 @@ type HookEvents struct { PullRequestSync bool `json:"pull_request_sync"` Repository bool `json:"repository"` Release bool `json:"release"` + Package bool `json:"package"` } // HookEvent represents events that will delivery hook. @@ -339,6 +340,12 @@ func (w *Webhook) HasRepositoryEvent() bool { (w.ChooseEvents && w.HookEvents.Repository) } +// HasPackageEvent returns if hook enabled package event. +func (w *Webhook) HasPackageEvent() bool { + return w.SendEverything || + (w.ChooseEvents && w.HookEvents.Package) +} + // EventCheckers returns event checkers func (w *Webhook) EventCheckers() []struct { Has func() bool @@ -368,6 +375,7 @@ func (w *Webhook) EventCheckers() []struct { {w.HasPullRequestSyncEvent, HookEventPullRequestSync}, {w.HasRepositoryEvent, HookEventRepository}, {w.HasReleaseEvent, HookEventRelease}, + {w.HasPackageEvent, HookEventPackage}, } } |