Documentation
¶
Index ¶
- func ResolveToken() (string, error)
- type Client
- func (c *Client) FetchJobs(ctx context.Context, runID int64) ([]model.Job, error)
- func (c *Client) FetchRunDetails(ctx context.Context, runs []model.WorkflowRun) (details []model.RunDetail, warnings []Warning)
- func (c *Client) FetchRunDetailsGraphQL(ctx context.Context, runs []model.WorkflowRun) (details []model.RunDetail, warnings []Warning)
- func (c *Client) FetchRuns(ctx context.Context, workflowID int64, since time.Time, branch string) ([]model.WorkflowRun, []Warning, error)
- func (c *Client) ListWorkflows(ctx context.Context) ([]model.Workflow, error)
- func (c *Client) RateLimit(ctx context.Context) (RateLimitStatus, error)
- type ClientOption
- type RateLimitStatus
- type Warning
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResolveToken ¶
ResolveToken returns a GitHub API token. It checks GITHUB_TOKEN env var first, then falls back to `gh auth token`.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps the GitHub API for fetching Actions workflow data.
func NewClient ¶
func NewClient(token, ownerRepo string, opts ...ClientOption) (*Client, error)
NewClient creates a Client for the given owner/repo.
func (*Client) FetchRunDetails ¶
func (c *Client) FetchRunDetails(ctx context.Context, runs []model.WorkflowRun) (details []model.RunDetail, warnings []Warning)
FetchRunDetails hydrates a slice of workflow runs with their jobs and steps. Uses a worker pool for bounded concurrency. Returns partial results and warnings for runs that failed to fetch.
func (*Client) FetchRunDetailsGraphQL ¶
func (c *Client) FetchRunDetailsGraphQL(ctx context.Context, runs []model.WorkflowRun) (details []model.RunDetail, warnings []Warning)
FetchRunDetailsGraphQL hydrates runs with jobs+steps using batched GraphQL queries. Falls back to REST for runs whose node_id is empty.
func (*Client) FetchRuns ¶
func (c *Client) FetchRuns(ctx context.Context, workflowID int64, since time.Time, branch string) ([]model.WorkflowRun, []Warning, error)
FetchRuns fetches completed workflow runs for a specific workflow since the given time. Uses sliding date windows to avoid the GitHub API 1,000-result cap. If branch is empty, runs from all branches are returned.
func (*Client) ListWorkflows ¶
ListWorkflows returns all workflows in the repository.
type ClientOption ¶
type ClientOption func(*Client)
ClientOption configures optional Client behaviour.
func WithLogger ¶
func WithLogger(l *slog.Logger) ClientOption
WithLogger sets a structured logger for the client.
func WithMaxConcurrentJobs ¶
func WithMaxConcurrentJobs(n int) ClientOption
WithMaxConcurrentJobs sets the maximum number of concurrent job-fetch API calls.
type RateLimitStatus ¶
RateLimitStatus contains the current rate limit state.
type Warning ¶
type Warning = diag.Diagnostic
Warning is a deprecated alias for diag.Diagnostic. Use diag.Diagnostic directly.