github

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: Apache-2.0 Imports: 4 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) ClientForInstallation

func (a *App) ClientForInstallation(installationID int64) *gh.Client

ClientForInstallation returns an authenticated GitHub client for the given installation.

func (*App) GetInstallationToken

func (a *App) GetInstallationToken(ctx context.Context, installationID int64) (string, error)

GetInstallationToken returns an installation access token for the given installation ID.

func (*App) ParseEvent

func (a *App) ParseEvent(eventType string, payload []byte) (any, error)

ParseEvent parses a webhook payload into a typed event struct.

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