trampoline

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidatePayload

func ValidatePayload(r *http.Request, secrets [][]byte) ([]byte, error)

ValidatePayload validates the payload of a webhook request for a given set of secrets. If any of the secrets are valid, the payload is returned with no error.

Types

type PayloadInfo

type PayloadInfo struct {
	Action     string `json:"action,omitempty"`
	Number     int    `json:"number,omitempty"`
	Repository struct {
		FullName string `json:"full_name,omitempty"`
		Owner    struct {
			Login string `json:"login,omitempty"`
		} `json:"owner,omitempty"`
		Name string `json:"name,omitempty"`
	} `json:"repository,omitempty"`
	Organization struct {
		Login string `json:"login,omitempty"`
	} `json:"organization,omitempty"`
	PullRequest struct {
		Number int  `json:"number,omitempty"`
		Merged bool `json:"merged,omitempty"`
	} `json:"pull_request,omitempty"`
	Issue struct {
		Number          int       `json:"number,omitempty"`
		PullRequestInfo *struct{} `json:"pull_request,omitempty"`
	} `json:"issue,omitempty"`
	CheckRun struct {
		PullRequests []struct {
			Number int `json:"number,omitempty"`
		} `json:"pull_requests,omitempty"`
	} `json:"check_run,omitempty"`
	CheckSuite struct {
		PullRequests []struct {
			Number int `json:"number,omitempty"`
		} `json:"pull_requests,omitempty"`
	} `json:"check_suite,omitempty"`
	Comment struct {
		ID int `json:"id,omitempty"`
	} `json:"comment,omitempty"`
	Review struct {
		ID int `json:"id,omitempty"`
	} `json:"review,omitempty"`
}

PayloadInfo is a minimal struct for GitHub webhook payload information, containing only the fields we need to process for our needs of setting cloud event headers.

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(client cloudevents.Client, opts ServerOptions) *Server

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

type ServerOptions

type ServerOptions struct {
	Secrets              [][]byte
	WebhookID            []string
	RequestedOnlyWebhook []string
	OrgFilter            []string
}

Jump to

Keyboard shortcuts

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