Documentation
¶
Overview ¶
Package github implements gitprovider.GitProvider against GitHub via go-github.
Index ¶
- type App
- func (a *App) AccountOf(ctx context.Context, owner, name string) (int64, error)
- func (a *App) CloneToken(ctx context.Context, owner, name string) (string, error)
- func (a *App) ForRepo(ctx context.Context, owner, name string) (*Client, error)
- func (a *App) InstallationAccounts(ctx context.Context) ([]*gitprovider.Installation, error)
- func (a *App) InstallationToken(ctx context.Context, id int64) (string, error)
- type AppCache
- type Client
- func (c *Client) CreateIssue(ctx context.Context, owner, name string, in gitprovider.IssueInput) (*gitprovider.Issue, error)
- func (c *Client) CreateIssueComment(ctx context.Context, owner, name string, number int, body string) (*gitprovider.IssueComment, error)
- func (c *Client) CreateWebhook(ctx context.Context, owner, name string, cfg gitprovider.WebhookConfig) (string, error)
- func (c *Client) DeleteIssueComment(ctx context.Context, owner, name string, commentID int64) error
- func (c *Client) DeleteWebhook(ctx context.Context, owner, name, hookID string) error
- func (c *Client) GetFile(ctx context.Context, owner, name, ref, filePath string) ([]byte, error)
- func (c *Client) GetIssue(ctx context.Context, owner, name string, number int) (*gitprovider.Issue, error)
- func (c *Client) GetPR(ctx context.Context, owner, name string, number int) (*gitprovider.PR, error)
- func (c *Client) GetRepo(ctx context.Context, owner, name string) (*gitprovider.Repo, error)
- func (c *Client) GetTree(ctx context.Context, owner, name, ref string) ([]gitprovider.TreeEntry, error)
- func (c *Client) ListInstallationRepos(ctx context.Context) ([]*gitprovider.Repo, error)
- func (c *Client) ListInstallations(ctx context.Context) ([]*gitprovider.Installation, error)
- func (c *Client) ListIssueComments(ctx context.Context, owner, name string, number int, since time.Time) ([]*gitprovider.IssueComment, error)
- func (c *Client) ListIssues(ctx context.Context, owner, name string, opts gitprovider.IssueOpts) ([]*gitprovider.Issue, int, error)
- func (c *Client) ListPRs(ctx context.Context, owner, name string, opts gitprovider.PROpts) ([]*gitprovider.PR, error)
- func (c *Client) ListWebhooks(ctx context.Context, owner, name string) ([]gitprovider.Webhook, error)
- func (c *Client) MergedInto(ctx context.Context, owner, name string, number int, sha string) (bool, error)
- func (c *Client) PRsForCommit(ctx context.Context, owner, name, sha string) ([]*gitprovider.PR, error)
- func (c *Client) RateLimit(ctx context.Context) (gitprovider.Rate, error)
- func (c *Client) UpdateIssue(ctx context.Context, owner, name string, number int, p gitprovider.IssuePatch) (*gitprovider.Issue, error)
- func (c *Client) UpdateIssueComment(ctx context.Context, owner, name string, commentID int64, body string) (*gitprovider.IssueComment, error)
- func (c *Client) UpdateWebhook(ctx context.Context, owner, name, hookID string) error
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App reads GitHub as the GitHub App: a JWT signed with its private key mints a token per installation (ADR 0144).
func (*App) CloneToken ¶
CloneToken mints a token that reads only owner/name's contents, what a runner clones with; it is never cached, so no other repository or permission of the installation ever reaches a runner.
func (*App) InstallationAccounts ¶
func (a *App) InstallationAccounts(ctx context.Context) ([]*gitprovider.Installation, error)
InstallationAccounts lists every installation of the App with its account, one request per hundred.
type AppCache ¶
type AppCache struct {
// Reresolve answers a rejected private key with its fresh PEM when its secret manager has one.
Reresolve func(ctx context.Context, stale string) (string, bool)
// contains filtered or unexported fields
}
AppCache keeps one App per key, client ID and server, so its tokens outlive the request that minted them.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the go-github-backed GitProvider implementation.
func New ¶
New builds a GitHub client; an empty token sends no auth header, giving unconfigured workspaces public access.
func (*Client) CreateIssue ¶
func (c *Client) CreateIssue(ctx context.Context, owner, name string, in gitprovider.IssueInput) (*gitprovider.Issue, error)
CreateIssue implements gitprovider.GitProvider.
func (*Client) CreateIssueComment ¶
func (c *Client) CreateIssueComment(ctx context.Context, owner, name string, number int, body string) (*gitprovider.IssueComment, error)
CreateIssueComment implements gitprovider.GitProvider.
func (*Client) CreateWebhook ¶
func (c *Client) CreateWebhook(ctx context.Context, owner, name string, cfg gitprovider.WebhookConfig) (string, error)
CreateWebhook implements gitprovider.GitProvider, returning the hook id.
func (*Client) DeleteIssueComment ¶
DeleteIssueComment implements gitprovider.GitProvider.
func (*Client) DeleteWebhook ¶
DeleteWebhook implements gitprovider.GitProvider.
func (*Client) GetFile ¶
GetFile implements gitprovider.GitProvider: a file's decoded content at ref, resolving ref to the repo's default branch via GetRepo when empty.
func (*Client) GetIssue ¶
func (c *Client) GetIssue(ctx context.Context, owner, name string, number int) (*gitprovider.Issue, error)
GetIssue implements gitprovider.GitProvider.
func (*Client) GetPR ¶
func (c *Client) GetPR(ctx context.Context, owner, name string, number int) (*gitprovider.PR, error)
GetPR implements gitprovider.GitProvider.
func (*Client) GetTree ¶
func (c *Client) GetTree(ctx context.Context, owner, name, ref string) ([]gitprovider.TreeEntry, error)
GetTree implements gitprovider.GitProvider: the recursive tree at ref, resolving ref to the repo's default branch via GetRepo when empty.
func (*Client) ListInstallationRepos ¶
ListInstallationRepos lists every repository across every App installation the user's token grants, fetched a page of installations at a time, a page of repos at a time.
func (*Client) ListInstallations ¶
func (c *Client) ListInstallations(ctx context.Context) ([]*gitprovider.Installation, error)
ListInstallations lists the App installations the user's token sees; only a "selected" installation costs a second request, a one-item page read for its total_count.
func (*Client) ListIssueComments ¶
func (c *Client) ListIssueComments(ctx context.Context, owner, name string, number int, since time.Time) ([]*gitprovider.IssueComment, error)
ListIssueComments implements gitprovider.GitProvider: every comment on issue number updated at or after since, all pages.
func (*Client) ListIssues ¶
func (c *Client) ListIssues(ctx context.Context, owner, name string, opts gitprovider.IssueOpts) ([]*gitprovider.Issue, int, error)
ListIssues implements gitprovider.GitProvider: one page of issues, pull requests left out, and the next page, 0 after the last.
func (*Client) ListPRs ¶
func (c *Client) ListPRs(ctx context.Context, owner, name string, opts gitprovider.PROpts) ([]*gitprovider.PR, error)
ListPRs implements gitprovider.GitProvider.
func (*Client) ListWebhooks ¶
func (c *Client) ListWebhooks(ctx context.Context, owner, name string) ([]gitprovider.Webhook, error)
ListWebhooks implements gitprovider.GitProvider.
func (*Client) MergedInto ¶
func (c *Client) MergedInto(ctx context.Context, owner, name string, number int, sha string) (bool, error)
MergedInto implements gitprovider.GitProvider through GitHub's compare of the pull request's merge commit with sha.
func (*Client) PRsForCommit ¶
func (c *Client) PRsForCommit(ctx context.Context, owner, name, sha string) ([]*gitprovider.PR, error)
PRsForCommit implements gitprovider.GitProvider.
func (*Client) UpdateIssue ¶
func (c *Client) UpdateIssue(ctx context.Context, owner, name string, number int, p gitprovider.IssuePatch) (*gitprovider.Issue, error)
UpdateIssue implements gitprovider.GitProvider, sending only the fields the patch sets.
func (*Client) UpdateIssueComment ¶
func (c *Client) UpdateIssueComment(ctx context.Context, owner, name string, commentID int64, body string) (*gitprovider.IssueComment, error)
UpdateIssueComment implements gitprovider.GitProvider.