INNER CODE UNIT · Go
handleEvent
alexellis/derek · main.go:70
func handleEvent(eventType string, bytesIn []byte, config config.Config) error {
switch eventType {
case "pull_request":
req := types.PullRequestOuter{}
if err := json.Unmarshal(bytesIn, &req); err != nil {
return fmt.Errorf("Cannot parse input %s", err.Error())
}
customer, err := auth.IsCustomer(req.Repository.Owner.Login, &http.Client{})
if err != nil {
return fmt.Errorf("Unable to verify customer: %s/%s", req.Repository.Owner.Login, req.Repository.Name)
} else if !customer {
return fmt.Errorf("No customer found for: %s/%s", req.Repository.Owner.Login, req.Repository.Name)
}
log.Printf("Owner: %s, repo: %s, action: %s", req.Repository.Owner.Login, req.Repository.Name, "pull_request")