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
- func New(cfg connectors.Config) (connectors.Tracker, error)
- type Adapter
- func (a *Adapter) FindByOperation(ctx context.Context, op string, raw json.RawMessage, operationID string) (*connectors.Result, error)
- func (a *Adapter) Invoke(ctx context.Context, op string, raw json.RawMessage, operationID string) (connectors.Result, error)
- func (a *Adapter) IsApp() bool
- func (a *Adapter) IssueCredential(ctx context.Context, scope connectors.CredentialScope) (connectors.Credential, error)
- func (a *Adapter) OperationTargets(op string, raw json.RawMessage) ([]string, error)
- func (a *Adapter) ReadOnly(op string) bool
- func (a *Adapter) RevokeCredential(ctx context.Context, token string) error
- func (a *Adapter) Verify(ctx context.Context) error
Constants ¶
const DefaultEndpoint = "https://api.github.com"
DefaultEndpoint is the GitHub REST API.
const MarkerPrefix = "steadmesh-op:"
MarkerPrefix marks records created by an operation.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(cfg connectors.Config) (connectors.Tracker, error)
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) 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
OperationTargets authorizes the repository that Invoke actually uses. There is deliberately no caller-supplied authorization-only target parameter.
func (*Adapter) RevokeCredential ¶
RevokeCredential invalidates an installation token at GitHub. A PAT cannot be invalidated by Steadmesh.