Documentation
¶
Overview ¶
Package github provides a client for interacting with GitHub API operations.
Index ¶
Constants ¶
const ( StatusQueued = "queued" StatusInProgress = "in_progress" StatusCompleted = "completed" )
RunStatus constants.
const ( ConclusionSuccess = "success" ConclusionFailure = "failure" ConclusionCancelled = "cancelled" //nolint:misspell // matches GitHub Actions API's actual conclusion value ConclusionSkipped = "skipped" )
Conclusion constants.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps the GitHub API via gh CLI.
func NewClient ¶
NewClient creates a new GitHub API client for the specified repository. Uses the real gh CLI executor by default.
func NewClientWithExecutor ¶
func NewClientWithExecutor(repoFullName string, executor exec.CommandExecutor) (*Client, error)
NewClientWithExecutor creates a new GitHub API client with a custom executor. This allows injecting a mock executor for testing.
func (*Client) GetLatestRun ¶
func (c *Client) GetLatestRun(workflowName string) (*WorkflowRun, error)
GetLatestRun fetches the most recent workflow run, optionally filtered by workflow name.
func (*Client) GetWorkflowRun ¶
func (c *Client) GetWorkflowRun(runID int64) (*WorkflowRun, error)
GetWorkflowRun fetches a single workflow run by ID.
func (*Client) GetWorkflowRunJobs ¶
GetWorkflowRunJobs fetches the jobs for a workflow run.
type Job ¶
type Job struct {
ID int64 `json:"id"`
Name string `json:"name"`
Status string `json:"status"`
Conclusion string `json:"conclusion"`
StartedAt time.Time `json:"started_at"`
Steps []Step `json:"steps"`
}
Job represents a job within a workflow run.
type JobsResponse ¶
JobsResponse represents the API response for listing jobs.
type RunsResponse ¶
type RunsResponse struct {
TotalCount int `json:"total_count"`
WorkflowRuns []WorkflowRun `json:"workflow_runs"`
}
RunsResponse represents the API response for listing runs.
type Step ¶
type Step struct {
Name string `json:"name"`
Status string `json:"status"`
Conclusion string `json:"conclusion"`
Number int `json:"number"`
}
Step represents a step within a job.
type WorkflowRun ¶
type WorkflowRun struct {
ID int64 `json:"id"`
Name string `json:"name"`
Status string `json:"status"`
Conclusion string `json:"conclusion"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
HTMLURL string `json:"html_url"`
HeadBranch string `json:"head_branch"`
}
WorkflowRun represents a GitHub Actions workflow run.
func (WorkflowRun) IsActive ¶
func (r WorkflowRun) IsActive() bool
IsActive returns true if the run is still in progress.
func (WorkflowRun) IsSuccess ¶
func (r WorkflowRun) IsSuccess() bool
IsSuccess returns true if the run completed successfully.