arquillian / ike-prow-plugins

Set of plugins for Prow automation platform
Apache License 2.0
9 stars 10 forks source link

Refactor EventHandler interface #197

Closed MatousJobanek closed 6 years ago

MatousJobanek commented 6 years ago

Currently, we have EventHandler interface with one method:

HandleEvent(log log.Logger, eventType github.EventType, payload []byte) error

it takes the event and in every plugin implementations it checks for the type of the event and unmarshals to the corresponding object. This behavior is same in all plugin implementations. To minimize the code duplication change the interface to contain two methods:

HandlePullRequestEvent(log log.Logger, event *gogh.PullRequestEvent) error
HandleIssueCommentEvent(log log.Logger, event *gogh.IssueCommentEvent) error

and move the common logic to the server.go