handler

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2026 License: BSD-2-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

AvailableWebhookHeaders lists the webhook header names the handler reads.

Functions

This section is empty.

Types

type SinglePRTriggerHandler

type SinglePRTriggerHandler = libhttp.WithError

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

type WebhookHandler = libhttp.WithError

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL