Documentation
¶
Overview ¶
Package github is GitHub's webhook protocol: its calls are signed, with the secret, in X-Hub-Signature-256, say what happened in X-GitHub-Event, and the body's action, and their delivery in X-GitHub-Delivery. A call whose content type is a form has its JSON in the form's payload field.
https://docs.github.com/en/webhooks/using-webhooks/validating-webhook-deliveries
Index ¶
- Constants
- type Protocol
- func (Protocol) Check(method string, header http.Header) error
- func (Protocol) Decode(header http.Header, body []byte) (json.RawMessage, error)
- func (Protocol) Handshake(*http.Request, string) ([]byte, bool)
- func (Protocol) Headers() []string
- func (Protocol) Identify(header http.Header, values json.RawMessage) (string, string)
- func (Protocol) Name() string
- func (Protocol) Sample(delivery string) (http.Header, []byte)
- func (Protocol) Sign(header http.Header, body []byte, secret string)
- func (Protocol) Verify(header http.Header, body []byte, secret string) error
Constants ¶
const (
// Name is the protocol's name
Name = "github"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Protocol ¶
type Protocol struct{}
Protocol is GitHub's protocol
func (Protocol) Check ¶ added in v1.7.4
Check returns nil when the call is a POST, with its event in X-GitHub-Event, as every call of GitHub's is
func (Protocol) Decode ¶
Decode returns the body, or, when it's a form, its payload field, which is the JSON
func (Protocol) Identify ¶
Identify returns X-GitHub-Event, and the body's action, when it has one, such as issues.opened, and X-GitHub-Delivery
func (Protocol) Sample ¶ added in v1.7.4
Sample returns a ping, which GitHub sends when a webhook is set up