( _ context.Context, req *webhookv1alpha1.EventRequest, )
| 13 | type webhookEventHandler struct{} |
| 14 | |
| 15 | func (h *webhookEventHandler) Event( |
| 16 | _ context.Context, |
| 17 | req *webhookv1alpha1.EventRequest, |
| 18 | ) (*webhookv1alpha1.EventResponse, error) { |
| 19 | // Handle the type-safe incoming request for the push event: |
| 20 | switch req.GetEvent() { |
| 21 | case registryv1alpha1.WebhookEvent_WEBHOOK_EVENT_REPOSITORY_PUSH: |
| 22 | pushEvent := req.GetPayload().GetRepositoryPush() |
| 23 | fmt.Println("received repo push event:", pushEvent) |
| 24 | default: |
| 25 | fmt.Println("unknown event:", req.GetEvent()) |
| 26 | } |
| 27 | |
| 28 | // Webhook listener has an empty response |
| 29 | return &webhookv1alpha1.EventResponse{}, nil |
| 30 | } |
| 31 | |
| 32 | // Connect handler based on: https://connectrpc.com/docs/go/getting-started#implement-handler |
| 33 | func main() { |
no outgoing calls