github

package
v0.0.0-...-229e418 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2026 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package github provides GitHub App authentication and API access.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppClient

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

AppClient manages GitHub App authentication.

func NewAppClient

func NewAppClient(appID, privateKeyPEM string, logger *slog.Logger) (*AppClient, error)

NewAppClient creates a new GitHub App client.

func (*AppClient) ClientForOrg

func (c *AppClient) ClientForOrg(ctx context.Context, org string) (*github.Client, error)

ClientForOrg returns an authenticated GitHub client for an organization.

func (*AppClient) HTTPClient

func (c *AppClient) HTTPClient(ctx context.Context, org string) (*http.Client, error)

HTTPClient returns an authenticated HTTP client for an organization.

func (*AppClient) TokenForOrg

func (c *AppClient) TokenForOrg(ctx context.Context, org string) (string, error)

TokenForOrg returns an installation token for an organization.

type Manager

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

Manager manages GitHub App installations across multiple orgs.

func NewManager

func NewManager(ctx context.Context, appClient *AppClient, allowPersonalAccounts bool) (*Manager, error)

NewManager creates a new GitHub installation manager.

func (*Manager) AllOrgs

func (m *Manager) AllOrgs() []string

AllOrgs returns all orgs with GitHub App installations.

func (*Manager) AppClient

func (m *Manager) AppClient() *AppClient

AppClient returns the underlying AppClient for creating searchers.

func (*Manager) ClientForOrg

func (m *Manager) ClientForOrg(org string) (*OrgClient, bool)

ClientForOrg returns the client for an org.

func (*Manager) RefreshInstallations

func (m *Manager) RefreshInstallations(ctx context.Context) error

RefreshInstallations discovers all GitHub App installations.

type OrgClient

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

OrgClient wraps a GitHub client for an org with additional functionality.

func (*OrgClient) Client

func (c *OrgClient) Client() *github.Client

Client returns the underlying GitHub API client.

func (*OrgClient) InstallationToken

func (c *OrgClient) InstallationToken(ctx context.Context) (string, error)

InstallationToken returns a fresh installation token.

func (*OrgClient) Org

func (c *OrgClient) Org() string

Org returns the organization name.

type Searcher

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

Searcher queries GitHub for PRs using the search API.

func NewSearcher

func NewSearcher(appClient appClient, logger *slog.Logger) *Searcher

NewSearcher creates a new PR searcher.

func (*Searcher) ListAuthoredPRs

func (s *Searcher) ListAuthoredPRs(ctx context.Context, org, githubUsername string) ([]bot.PRSearchResult, error)

ListAuthoredPRs returns open PRs authored by a specific user.

func (*Searcher) ListClosedPRs

func (s *Searcher) ListClosedPRs(ctx context.Context, org string, closedWithinHours int) ([]bot.PRSearchResult, error)

ListClosedPRs returns recently closed/merged PRs for catching terminal states.

func (*Searcher) ListOpenPRs

func (s *Searcher) ListOpenPRs(ctx context.Context, org string, updatedWithinHours int) ([]bot.PRSearchResult, error)

ListOpenPRs returns open PRs for an org updated within the given hours.

func (*Searcher) ListReviewRequestedPRs

func (s *Searcher) ListReviewRequestedPRs(ctx context.Context, org, githubUsername string) ([]bot.PRSearchResult, error)

ListReviewRequestedPRs returns open PRs where a specific user is requested to review.

Jump to

Keyboard shortcuts

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