Skip to content

Defining the GitHub webhook handler

Administrator requested to merge githubWebhookHandler into main

Created by: susantoscott

This PR contains the definition for a GitHubWebhookHandler. Given a payload from GitHub, which comes in the form of a gh.PushEvent, GitHubWebhookHandler receives this payload, processes it, and makes a call to repoupdater.EnqueueRepoUpdate. Along the way, it uses similar middleware to the batch changes webhooks, implementing the Registerer interface and using the same ServeHTTP method. This explains why the github_webhook_handler.go code is relatively short: as a Registerer, a lot of work including validating secrets, parsing config, and many more is already done in cmd/frontend/webhooks/github_webhooks.go.

This builds on the work of the background webhook worker from the previous PR.

Test plan

go test -run TestGitHubWebhookHandle

Merge request reports

Loading