Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var AvailableWebhookHeaders = []WebhookHeader{WebhookSignatureHeader, WebhookEventHeader}
AvailableWebhookHeaders lists the webhook header names the handler reads.
Functions ¶
This section is empty.
Types ¶
type SinglePRTriggerHandler ¶
SinglePRTriggerHandler handles POST /trigger?url=<pr_url>. The handler is intentionally thin: parse the URL, validate it synchronously, publish a TriggerPRReviewCommand to Kafka, and return HTTP 202. All GitHub API access, filter evaluation, and trust decision logic is owned by the in-pod command consumer.
func NewSinglePRTriggerHandler ¶
func NewSinglePRTriggerHandler( sender command.TriggerPRReviewCommandSender, ) SinglePRTriggerHandler
NewSinglePRTriggerHandler returns a handler that publishes a TriggerPRReviewCommand to Kafka for each valid /trigger request.
type WebhookHandler ¶ added in v0.6.0
WebhookHandler handles POST /webhook/github-pr. The handler is intentionally thin, mirroring SinglePRTriggerHandler: verify the GitHub HMAC signature, extract the PR URL from the pull_request event, publish a TriggerPRReviewCommand to Kafka, and return 202. All GitHub API access, filter evaluation, and trust logic stays in the in-pod command consumer (shared with /trigger), so gates 1–4 and the (repo, sha) task-ID dedup apply to webhook deliveries unchanged.
func NewWebhookHandler ¶ added in v0.6.0
func NewWebhookHandler( sender command.TriggerPRReviewCommandSender, secret string, metrics WebhookMetrics, clock libtime.CurrentDateTimeGetter, ) WebhookHandler
NewWebhookHandler returns a handler that publishes a TriggerPRReviewCommand for each signature-verified pull_request webhook delivery.
type WebhookHeader ¶ added in v0.6.0
type WebhookHeader string
WebhookHeader is a typed GitHub webhook header name, so header-name typos are caught by the type system.
const ( WebhookSignatureHeader WebhookHeader = "X-Hub-Signature-256" WebhookEventHeader WebhookHeader = "X-GitHub-Event" )
type WebhookMetrics ¶ added in v0.6.0
type WebhookMetrics interface {
IncWebhookDelivery(result string)
IncWebhookSignatureRejected()
ObserveWebhookDispatchLatency(seconds float64)
}
WebhookMetrics is the narrow slice of watcher metrics the webhook handler records. pkg.Metrics satisfies it structurally, keeping this handler free of the pkg import — mirroring trigger_handler's thin dependency set.