github

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package github implements the read-only Source for GitHub.com (and, by base URL, GitHub Enterprise Server). Auth is a GitHub App installation token, short-lived, least-privilege, and App-compatible. Metadata uses per-resource REST endpoints, not the Migrations API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	BaseURL        string // empty = github.com; GHES: https://host/api/v3
	AppID          int64
	InstallationID int64
	PrivateKeyPEM  []byte
}

Options configures the GitHub source.

type Source

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

Source is a read-only GitHub backend.

func New

func New(opts Options, logger *slog.Logger) (*Source, error)

New builds a GitHub source authenticated as an App installation.

func (*Source) CloneURL

func (s *Source) CloneURL(_ context.Context, r source.Repo) (string, error)

CloneURL returns the HTTPS clone URL (no embedded credentials).

func (*Source) FetchMetadata

func (s *Source) FetchMetadata(ctx context.Context, r source.Repo) ([]byte, error)

FetchMetadata dumps per-resource metadata as gitdr.meta/v1 JSON using App-compatible per-resource REST endpoints (never the Migrations API).

func (*Source) GitAuthHeader

func (s *Source) GitAuthHeader(ctx context.Context) (string, error)

GitAuthHeader mints an installation token and returns it as a Basic auth header (username x-access-token). Injected into git via env so it never hits argv.

func (*Source) ListRepos

func (s *Source) ListRepos(ctx context.Context, f source.Filter) ([]source.Repo, error)

ListRepos returns repositories accessible to the installation, filtered.

Jump to

Keyboard shortcuts

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