github

package
v0.0.0-...-c98162d Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package github implements forge.Forge for GitHub via a GitHub App.

Index

Constants

View Source
const DefaultBaseURL = "https://api.github.com"

DefaultBaseURL is github.com's REST root. Tests inject a ghfake URL.

Variables

This section is empty.

Functions

func CheckRunToState

func CheckRunToState(status, conclusion string) forge.CheckState

CheckRunToState maps a GitHub check run back to a forge.CheckState. Unfinished runs are pending; neutral/skipped count as success so they do not block the queue.

func InstallationSource

func InstallationSource(app *App) func(context.Context) ([]forge.RepoRef, error)

InstallationSource refreshes the App's installation→repo map and returns every repo the App can see. Installation presence is the authorization signal on GitHub, so no further filtering is needed.

func NewForge

func NewForge(app *App, htmlURL string) forge.Forge

NewForge wraps a GitHub App as a forge. htmlURL is the user-facing web root (distinct from the API base URL); empty defaults to github.com.

Types

type App

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

App holds a GitHub App identity and vends per-installation API clients.

GitHub Apps cannot act on a repository without an installation that covers it, so the repo→installation map is the routing table for every API call.

func NewApp

func NewApp(appID int64, privateKey []byte, baseURL string) (*App, error)

NewApp constructs an App. baseURL must be the REST root (e.g. https://api.github.com or http://127.0.0.1:PORT/api/v3 for ghfake).

func (*App) AppID

func (a *App) AppID() int64

func (*App) ClientForRepo

func (a *App) ClientForRepo(owner, name string) (*gh.Client, error)

func (*App) Refresh

func (a *App) Refresh(ctx context.Context) error

Refresh repopulates the repo→installation map from the App's current installations. Called at startup and on installation* webhooks so newly installed repos become routable without restart.

func (*App) Repos

func (a *App) Repos() []forge.RepoRef

func (*App) SyncHookConfig

func (a *App) SyncHookConfig(ctx context.Context, externalURL, secret string) error

SyncHookConfig points the App's single global webhook at this instance so the secret never has to be entered in the GitHub UI by hand.

Directories

Path Synopsis
It is not a faithful simulator: only the endpoints gitea-mq calls are implemented, with just enough state to drive the adapter and integration tests deterministically without network access.
It is not a faithful simulator: only the endpoints gitea-mq calls are implemented, with just enough state to drive the adapter and integration tests deterministically without network access.

Jump to

Keyboard shortcuts

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