handler

package
v0.18.3 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: BSD-2-Clause Imports: 16 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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,
	coalescer coalesce.Coalescer,
	secret string,
	metrics WebhookMetrics,
	clock libtime.CurrentDateTimeGetter,
) WebhookHandler

NewWebhookHandler returns a handler that publishes a TriggerPRReviewCommand for each signature-verified pull_request webhook delivery, unless the coalescer holds the push for its trailing dispatch.

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