Documentation
¶
Overview ¶
Package ghclient wraps go-github with token resolution, an 8-way concurrency cap, and in-flight de-duplication/caching for repeated lookups.
Index ¶
- type Client
- func (c *Client) DefaultBranch(owner, repo string) (string, error)
- func (c *Client) ListRunJobs(owner, repo string, runID int64) ([]RunJob, error)
- func (c *Client) ListTags(owner, repo string) ([]string, error)
- func (c *Client) ListWorkflowRuns(owner, repo string, workflowID int64, branch string, since time.Time) ([]WorkflowRun, error)
- func (c *Client) ListWorkflows(owner, repo string) ([]WorkflowMeta, error)
- func (c *Client) ResolveSha(owner, repo, ref string) (string, error)
- func (c *Client) WarnIfUnauthenticated()
- type RunJob
- type WorkflowMeta
- type WorkflowRun
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
Authenticated bool
// contains filtered or unexported fields
}
Client is a concurrency- and cache-aware GitHub API client.
func New ¶
New constructs a client for the given host, resolving a token if available. host "" or "github.com" uses the public API; any other host is treated as a GitHub Enterprise Server instance (API at https://<host>/api/v3/).
func (*Client) DefaultBranch ¶
DefaultBranch returns the repo's default branch (e.g. "main").
func (*Client) ListRunJobs ¶
ListRunJobs returns the jobs for one workflow run.
func (*Client) ListWorkflowRuns ¶
func (c *Client) ListWorkflowRuns(owner, repo string, workflowID int64, branch string, since time.Time) ([]WorkflowRun, error)
ListWorkflowRuns returns a workflow's runs created on or after `since`, newest first (server-side filtered via the API's `created` query).
func (*Client) ListWorkflows ¶
func (c *Client) ListWorkflows(owner, repo string) ([]WorkflowMeta, error)
ListWorkflows lists the repo's workflows.
func (*Client) ResolveSha ¶
ResolveSha resolves a tag/branch/sha to a full commit SHA (cached, deduped).
func (*Client) WarnIfUnauthenticated ¶
func (c *Client) WarnIfUnauthenticated()
WarnIfUnauthenticated prints a rate-limit warning to stderr when no token.
type RunJob ¶
type RunJob struct {
Name string
StartedAt time.Time
HasStarted bool
CompletedAt time.Time
HasCompleted bool
}
RunJob is the subset of a job we need.
type WorkflowMeta ¶
WorkflowMeta is the subset of a workflow we need.