Documentation
¶
Index ¶
- type Client
- func (c *Client) CheckPermissions(ctx context.Context, needsOrg bool) error
- func (c *Client) DownloadRunLogs(ctx context.Context, owner, repo string, runID int64) ([]LogFile, error)
- func (c *Client) ListOrgRepos(ctx context.Context, org string) ([]string, error)
- func (c *Client) ListRunsInWindow(ctx context.Context, owner, repo, since, until string) ([]*github.WorkflowRun, error)
- type LogFile
- type RateLimitEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
GH *github.Client
PlainHTTP *http.Client // no Authorization header; for pre-signed S3 URLs
// OnRateLimit, if set, is called whenever the client hits or proactively
// avoids a rate limit. Set this before issuing API calls.
OnRateLimit func(RateLimitEvent)
// contains filtered or unexported fields
}
Client wraps the go-github client and a plain HTTP client for log downloads.
func (*Client) CheckPermissions ¶
CheckPermissions validates the token by calling /user and /rate_limit. For PATs it also inspects X-OAuth-Scopes for required scopes. GitHub App installation tokens (ghs_…) return 403 on /user — that is handled gracefully: the check falls back to /rate_limit only and skips scope validation (App tokens have permissions defined in their installation, not OAuth scopes).
func (*Client) DownloadRunLogs ¶
func (c *Client) DownloadRunLogs(ctx context.Context, owner, repo string, runID int64) ([]LogFile, error)
DownloadRunLogs fetches the workflow run logs zip and extracts all .txt files. Returns an empty slice (no error) if logs are unavailable (404).
func (*Client) ListOrgRepos ¶
ListOrgRepos returns all repos (full "owner/repo" strings) in the given org. It paginates until all pages are consumed.
func (*Client) ListRunsInWindow ¶
func (c *Client) ListRunsInWindow(ctx context.Context, owner, repo, since, until string) ([]*github.WorkflowRun, error)
ListRunsInWindow returns all workflow runs in [since, until] for the given repo. It paginates until all pages are consumed.