Help us shape the future of Go! Take the 2026 Go Developer Survey

github

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: Apache-2.0, MIT Imports: 14 Imported by: 0

Documentation

Overview

Package github is the source-control provider for GitHub and GitHub Enterprise Server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is one repository on one GitHub host.

func New

func New(ctx context.Context, remote string, settings map[string]any) (*Client, error)

New binds the repository behind an origin URL to its host's API. Tokens are minted within ctx.

func (*Client) ClosePullRequest

func (c *Client) ClosePullRequest(ctx context.Context, number int) error

func (*Client) CommitStatus

func (c *Client) CommitStatus(ctx context.Context, sha, name string) (string, error)

func (*Client) CreatePullRequest

func (c *Client) CreatePullRequest(ctx context.Context, head, base, title, body string) (sourcecontrol.PullRequest, error)

func (*Client) Credentials

func (c *Client) Credentials(context.Context) (string, string, error)

Credentials presents the access token as the git password.

func (*Client) Identity

func (c *Client) Identity(ctx context.Context) (sourcecontrol.Identity, error)

Identity derives the noreply identity GitHub attributes commits to: the App's bot user, or the token's user.

func (*Client) PullRequests

func (c *Client) PullRequests(ctx context.Context, state, head string) ([]sourcecontrol.PullRequest, error)

PullRequests lists pull requests in a state, page by page.

func (*Client) SetCommitStatus

func (c *Client) SetCommitStatus(ctx context.Context, sha string, status sourcecontrol.Status) error

SetCommitStatus records a status, keeping the description within the 140 characters GitHub stores.

func (*Client) UpdatePullRequest

func (c *Client) UpdatePullRequest(ctx context.Context, number int, title, body string) error

type Config

type Config struct {
	// ClientID, InstallationID and PrivateKey identify a GitHub App and its
	// installation on the repository's owner; short-lived installation
	// tokens are minted from them as needed. The installation ID is a
	// number in YAML or a string when it comes from the environment.
	ClientID       string      `json:"client_id,omitempty"`
	InstallationID json.Number `json:"installation_id,omitempty"`
	PrivateKey     string      `json:"private_key,omitempty"`
	// Token is a personal access token used instead of an App.
	Token string `json:"token,omitempty"`
}

Config is the provider configuration a Project declares under reconcile.source_control.config: a GitHub App installation, or a token.

Jump to

Keyboard shortcuts

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