github

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: Apache-2.0 Imports: 3 Imported by: 0 modules, 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

Overview

Package github provides GitHub App authentication, webhooks, and API client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

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

App provides GitHub App authentication and webhook handling.

func NewApp

func NewApp(cfg AppConfig) (*App, error)

NewApp creates a new App from the given configuration.

func NewAppFromTransport

func NewAppFromTransport(tr *ghinstallation.AppsTransport, webhookSecret string) (*App, error)

NewAppFromTransport creates a new App using a pre-configured AppsTransport. This is useful for testing with custom base URLs.

func (*App) AppsTransport added in v0.26.0

func (a *App) AppsTransport() *ghinstallation.AppsTransport

AppsTransport returns the transport authenticated as the App itself, with the App JWT, for the App's own endpoints such as GET /app.

func (*App) InstallationTransport added in v0.26.0

func (a *App) InstallationTransport(installationID int64) *ghinstallation.Transport

InstallationTransport returns a transport authenticated as the given installation. It caches the installation token and mints a new one only when the cached one is due for refresh, so a process builds one and shares it.

func (*App) ValidateWebhook

func (a *App) ValidateWebhook(r *http.Request) ([]byte, error)

ValidateWebhook validates the webhook signature and returns the raw payload.

type AppConfig

type AppConfig struct {
	AppID         int64
	PrivateKey    []byte //nolint:gosec // intentional field name for PEM-encoded RSA private key
	WebhookSecret string
}

AppConfig holds the configuration for a GitHub App.

Jump to

Keyboard shortcuts

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