Documentation
¶
Index ¶
- Constants
- 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 []diag.Diagnostic)
- func (c *Client) FetchRunDetailsGraphQL(ctx context.Context, runs []model.WorkflowRun) (details []model.RunDetail, warnings []diag.Diagnostic)
- func (c *Client) FetchRuns(ctx context.Context, workflowID int64, since time.Time, branch string) ([]model.WorkflowRun, []diag.Diagnostic, error)
- func (c *Client) GetCommitInfo(ctx context.Context, sha string) (CommitInfo, error)
- func (c *Client) ListWorkflows(ctx context.Context) ([]model.Workflow, error)
- func (c *Client) RateLimit(ctx context.Context) (RateLimitStatus, error)
- type ClientOption
- type CommitInfo
- type RateLimitStatus
- type RatePool
Constants ¶
const GraphQLBatchSize = 20
GraphQLBatchSize is the max number of runs fetched per GraphQL query. Each run with jobs+steps costs ~1-4 rate limit points.
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 []diag.Diagnostic)
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 []diag.Diagnostic)
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, []diag.Diagnostic, 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) GetCommitInfo ¶ added in v0.27.0
GetCommitInfo fetches a commit's changed files and classifies whether it touched CI configuration. Used to annotate change points (one bounded call per detected regression).
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.
type CommitInfo ¶ added in v0.27.0
type CommitInfo struct {
FilesChanged int
Additions int
Deletions int
CIConfigChange bool // any file under .github/workflows/
}
CommitInfo summarizes a commit for change-point attribution.
type RateLimitStatus ¶
RateLimitStatus carries the current state of both rate-limit pools.