github

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: MIT Imports: 5 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 defines the client used to resolve a git_patch's github source (a pull request or commit) against the GitHub REST API. It is a thin wrapper around github.com/google/go-github so tests can inject a fake.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// ResolvePR resolves a pull request number in repository (in "owner/name"
	// form) to its head commit SHA and the pull request's unified diff.
	ResolvePR(ctx context.Context, repository string, pr int64, token string) (Resolution, error)

	// ResolveCommit resolves a commit sha in repository (in "owner/name"
	// form) to its diff.
	ResolveCommit(ctx context.Context, repository, sha, token string) (Resolution, error)
}

Client resolves github patch sources against the GitHub API. An empty token means an unauthenticated request.

func New

func New(opts ...Option) Client

New creates a Client that talks to the GitHub REST API via go-github.

type Option

type Option func(*client)

Option configures a client constructed via New.

func WithBaseURL

func WithBaseURL(u string) Option

WithBaseURL overrides the API base URL. Intended for tests to point the client at a fake server.

type Resolution

type Resolution struct {
	SHA  string
	Diff string
}

Resolution is the result of resolving a pull request or commit to a concrete commit SHA and unified diff.

Jump to

Keyboard shortcuts

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