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

github

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package github is the GitHub connector. It authenticates as a GitHub App (secret keys app_id, installation_id, private_key) or with a fine-grained personal access token (secret key token).

It serves two kinds of access (docs/sandbox.html):

  • platform delivery: repository operations (repo.read, pull_request.*, issue.*) through the gateway and its ledger; the credential never leaves the platform. Created pull requests and comments carry a steadmesh-op marker so an ambiguous outcome is resolved by read-back;
  • sandbox delivery: IssueCredential returns a credential for git and gh in the sandbox. With an App it is an installation token limited to the granted repositories and permissions, valid for an hour, which RevokeCredential invalidates at GitHub. A PAT is returned as is: only as narrow as the token, and Steadmesh cannot invalidate it.

Index

Constants

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

DefaultEndpoint is the GitHub REST API.

View Source
const MarkerPrefix = "steadmesh-op:"

MarkerPrefix marks records created by an operation.

Variables

This section is empty.

Functions

func New

New builds the adapter from cfg.Secret.

Types

type Adapter

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

Adapter implements connectors.Tracker and connectors.CredentialIssuer.

func (*Adapter) FindByOperation

func (a *Adapter) FindByOperation(ctx context.Context, op string, raw json.RawMessage, operationID string) (*connectors.Result, error)

FindByOperation looks for a pull request or comment carrying the marker.

func (*Adapter) Invoke

func (a *Adapter) Invoke(ctx context.Context, op string, raw json.RawMessage, operationID string) (connectors.Result, error)

func (*Adapter) IsApp

func (a *Adapter) IsApp() bool

IsApp reports whether the adapter authenticates as a GitHub App.

func (*Adapter) IssueCredential

func (a *Adapter) IssueCredential(ctx context.Context, scope connectors.CredentialScope) (connectors.Credential, error)

IssueCredential returns a credential for the sandbox. With an App it is an installation token limited to the repositories and permissions, after binding every repository owner to the installation's account. A PAT cannot be scoped here and is returned unchanged.

func (*Adapter) OperationTargets added in v0.7.0

func (a *Adapter) OperationTargets(op string, raw json.RawMessage) ([]string, error)

OperationTargets authorizes the repository that Invoke actually uses. There is deliberately no caller-supplied authorization-only target parameter.

func (*Adapter) ReadOnly

func (a *Adapter) ReadOnly(op string) bool

func (*Adapter) RevokeCredential

func (a *Adapter) RevokeCredential(ctx context.Context, token string) error

RevokeCredential invalidates an installation token at GitHub. A PAT cannot be invalidated by Steadmesh.

func (*Adapter) Verify

func (a *Adapter) Verify(ctx context.Context) error

Verify checks the credential: GET /user for a PAT; for an App, GET /app and a minted installation token.

Jump to

Keyboard shortcuts

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