Documentation
¶
Overview ¶
Package github implements a polling Source backed by the GitHub Actions API.
Index ¶
- func APIURL(base string) string
- func AppInstallURL(base, slug string) string
- func InstallationID(ctx context.Context, appID int64, key []byte, a AppAuth) (int64, error)
- func ListInstallationRepos(ctx context.Context, c *github.Client) ([]*github.Repository, error)
- func NewAppClient(ctx context.Context, a AppAuth) (*github.Client, error)
- func NewClient(hc *http.Client, base string) (*github.Client, error)
- func WebURL(base string) string
- type AppAuth
- type Poller
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func APIURL ¶ added in v0.2.11
APIURL returns the REST API root of the instance at base, without a trailing slash. GHES serves its API under /api/v3.
func AppInstallURL ¶ added in v0.2.11
AppInstallURL returns the page that installs the App with slug. GHES serves App pages under /github-apps, github.com under /apps.
func InstallationID ¶
InstallationID resolves the App's installation for a's target (org or repo) via a JWT-only client. Shared by every source that authenticates as the App.
func ListInstallationRepos ¶
ListInstallationRepos paginates through all repos the App installation can access.
func NewAppClient ¶
NewAppClient returns a go-github client authenticated as the App installation for a's target (org or repo). The installation ID is discovered automatically.
Types ¶
type AppAuth ¶
type AppAuth struct {
AppID int64
PrivateKeyPath string
Org string
// Owner/Repo name a single repo target (personal-account or per-repo).
Owner string
Repo string
// Repos optionally restricts an org target's polling to these repo names;
// empty polls all installation repos. Unused for repo targets.
Repos []string
// BaseURL names a GHES instance; empty means github.com.
BaseURL string
}
AppAuth identifies a GitHub App installation. It is either org-scoped (Org set) or repo-scoped (Owner+Repo set, for personal-account repos that have no org-level runner pool). Exactly one form is populated.
func ParseScope ¶
ParseScope is Scope's inverse: a valid "owner/repo" → repo target, else org target. Kept beside Scope, built on the canonical grammar in domain.
type Poller ¶
type Poller struct {
// contains filtered or unexported fields
}
Poller polls every configured org's repos for queued workflow runs and emits each queued job as a domain.Job on every pass, from a fresh listing or from the run cache. A re-emission is what keeps a waiting job in the agent's queue; the agent and the control plane reject a repeat while a dispatch for the job is live.
func New ¶
func New(ctx context.Context, auths []AppAuth, interval time.Duration, m *metrics.Agent) (*Poller, error)
New authenticates as each AppAuth's installation and constructs a Poller. interval must be > 0; auths must be non-empty. m receives the per-org API error and breaker series.