Documentation
¶
Index ¶
- Constants
- Variables
- func IsValidConclusion(conclusion string) bool
- func IsValidStatus(status string) bool
- type APIRequestOptions
- type AnalysisMetadata
- type ConclusionSummary
- type ExecutionStats
- type OutputFormat
- type OutputOptions
- type StepStats
- type SuccessRate
- type TimestampRange
- type WorkflowAnalysisResult
- type WorkflowConclusion
- type WorkflowConfig
- type WorkflowFetchOptions
- type WorkflowJobStats
- type WorkflowRunStats
- type WorkflowRunSummary
- type WorkflowStatus
Constants ¶
const ( // Duration constants MaxWorkflowDurationSeconds = 35 * 24 * 60 * 60 // 35 days in seconds (GitHub Actions limit) MaxWorkflowDurationCapped = 3024000 // Capped duration value for invalid durations // GitHub API constants DefaultPerPage = 100 MaxPerPage = 100 DefaultJobCount = 3 // Time format constants GitHubTimeFormat = time.RFC3339 // Rate limiting DefaultRetryAttempts = 3 DefaultRetryDelay = time.Second * 5 // File extensions WorkflowFileExtension = ".yml" YAMLFileExtension = ".yaml" )
Variables ¶
var ( // Configuration errors ErrInvalidConfiguration = errors.New("invalid configuration") ErrMissingOrgRepo = errors.New("organization and repository must be specified") ErrMissingWorkflow = errors.New("workflow file or ID must be specified") ErrInvalidWorkflowID = errors.New("invalid workflow ID") ErrInvalidTimeRange = errors.New("invalid time range: start time must be before end time") // Validation errors ErrInvalidStatus = errors.New("invalid workflow status") ErrInvalidConclusion = errors.New("invalid workflow conclusion") ErrInvalidOutputFormat = errors.New("invalid output format") ErrInvalidJobCount = errors.New("invalid job count: must be positive") // Data processing errors ErrEmptyWorkflowRuns = errors.New("no workflow runs found") ErrEmptyWorkflowJobs = errors.New("no workflow jobs found") ErrInvalidDuration = errors.New("invalid duration value") )
Functions ¶
func IsValidConclusion ¶
IsValidConclusion returns true if the conclusion is valid
func IsValidStatus ¶
IsValidStatus returns true if the status is valid
Types ¶
type APIRequestOptions ¶
type APIRequestOptions struct {
Actor string `json:"actor,omitempty"`
Branch string `json:"branch,omitempty"`
Event string `json:"event,omitempty"`
Status string `json:"status,omitempty"` // Single status for API
Created string `json:"created,omitempty"`
HeadSHA string `json:"head_sha,omitempty"`
ExcludePullRequests bool `json:"exclude_pull_requests"`
CheckSuiteID int64 `json:"check_suite_id,omitempty"`
All bool `json:"all"`
}
APIRequestOptions represents options for GitHub API requests
type AnalysisMetadata ¶
type AnalysisMetadata struct {
GeneratedAt time.Time `json:"generated_at"`
Config *WorkflowConfig `json:"config"`
FetchOptions *WorkflowFetchOptions `json:"fetch_options"`
TotalFetched int `json:"total_fetched"`
TotalFiltered int `json:"total_filtered"`
RateLimited bool `json:"rate_limited,omitempty"`
}
AnalysisMetadata contains metadata about the analysis
type ConclusionSummary ¶
type ConclusionSummary struct {
Count int `json:"count"`
Runs []*WorkflowRunSummary `json:"runs"`
}
ConclusionSummary represents summary data for a specific conclusion
type ExecutionStats ¶
type ExecutionStats struct {
Min float64 `json:"min"`
Max float64 `json:"max"`
Mean float64 `json:"mean"`
Median float64 `json:"median"`
P95 float64 `json:"p95"`
P99 float64 `json:"p99"`
StdDev float64 `json:"std_dev"`
Count int `json:"count"`
}
ExecutionStats represents statistical data for execution durations
type OutputFormat ¶
type OutputFormat string
OutputFormat represents the output format type
const ( OutputFormatText OutputFormat = "text" OutputFormatJSON OutputFormat = "json" )
type OutputOptions ¶
type OutputOptions struct {
Format OutputFormat `json:"format"`
JobCount int `json:"job_count"`
}
OutputOptions represents options for output formatting
type StepStats ¶
type StepStats struct {
Name string `json:"name"`
Number int64 `json:"number"`
RunCount int `json:"run_count"`
Conclusions map[WorkflowConclusion]int `json:"conclusions"`
SuccessRate SuccessRate `json:"success_rate"`
ExecutionStats ExecutionStats `json:"execution_stats"`
FailureURLs []string `json:"failure_urls,omitempty"`
}
StepStats represents aggregated statistics for workflow steps
type SuccessRate ¶
type SuccessRate struct {
Success float64 `json:"success_rate"`
Failure float64 `json:"failure_rate"`
Others float64 `json:"others_rate"`
}
SuccessRate represents success/failure rates
type TimestampRange ¶
type TimestampRange struct {
Start *time.Time `json:"start,omitempty"`
End *time.Time `json:"end,omitempty"`
}
TimestampRange represents a time range for filtering
func (*TimestampRange) Validate ¶
func (tr *TimestampRange) Validate() error
Validate returns an error if the time range is invalid
type WorkflowAnalysisResult ¶
type WorkflowAnalysisResult struct {
RunStats *WorkflowRunStats `json:"run_stats"`
JobStats []*WorkflowJobStats `json:"job_stats,omitempty"`
Metadata *AnalysisMetadata `json:"metadata"`
}
WorkflowAnalysisResult represents the complete analysis result
type WorkflowConclusion ¶
type WorkflowConclusion string
WorkflowConclusion represents workflow execution conclusions
const ( ConclusionSuccess WorkflowConclusion = "success" ConclusionFailure WorkflowConclusion = "failure" ConclusionOthers WorkflowConclusion = "others" )
func NormalizeConclusion ¶
func NormalizeConclusion(conclusion string) WorkflowConclusion
NormalizeConclusion converts a conclusion string to a standard conclusion
func (WorkflowConclusion) String ¶
func (c WorkflowConclusion) String() string
String returns the string representation of WorkflowConclusion
type WorkflowConfig ¶
type WorkflowConfig struct {
Host string `json:"host"`
Org string `json:"org"`
Repo string `json:"repo"`
WorkflowFileName string `json:"workflow_file_name,omitempty"`
WorkflowID int64 `json:"workflow_id,omitempty"`
}
WorkflowConfig represents configuration for workflow operations
func (*WorkflowConfig) IsValid ¶
func (c *WorkflowConfig) IsValid() bool
IsValid returns true if the configuration has the required fields
type WorkflowFetchOptions ¶
type WorkflowFetchOptions struct {
// Filter options
Actor string `json:"actor,omitempty"`
Branch string `json:"branch,omitempty"`
Event string `json:"event,omitempty"`
Status []string `json:"status,omitempty"`
Created string `json:"created,omitempty"`
HeadSHA string `json:"head_sha,omitempty"`
ExcludePullRequests bool `json:"exclude_pull_requests"`
CheckSuiteID int64 `json:"check_suite_id,omitempty"`
All bool `json:"all"`
// Display options
OutputJSON bool `json:"output_json"`
JobCount int `json:"job_count"`
}
WorkflowFetchOptions represents options for fetching workflow data
func (*WorkflowFetchOptions) ToAPIRequestOptions ¶
func (o *WorkflowFetchOptions) ToAPIRequestOptions() *APIRequestOptions
ToAPIRequestOptions converts WorkflowFetchOptions to APIRequestOptions
type WorkflowJobStats ¶
type WorkflowJobStats struct {
Name string `json:"name"`
TotalCount int `json:"total_count"`
SuccessRate SuccessRate `json:"success_rate"`
Conclusions map[WorkflowConclusion]int `json:"conclusions"`
ExecutionStats ExecutionStats `json:"execution_stats"`
Steps []*StepStats `json:"steps"`
}
WorkflowJobStats represents aggregated statistics for workflow jobs
type WorkflowRunStats ¶
type WorkflowRunStats struct {
TotalCount int `json:"total_count"`
Name string `json:"name"`
SuccessRate SuccessRate `json:"success_rate"`
ExecutionStats ExecutionStats `json:"execution_stats"`
Conclusions map[WorkflowConclusion]*ConclusionSummary `json:"conclusions"`
}
WorkflowRunStats represents aggregated statistics for workflow runs
type WorkflowRunSummary ¶
type WorkflowRunSummary struct {
ID int64 `json:"id"`
Status WorkflowStatus `json:"status"`
Conclusion WorkflowConclusion `json:"conclusion"`
Actor string `json:"actor"`
RunAttempt int `json:"run_attempt"`
HTMLURL string `json:"html_url"`
JobsURL string `json:"jobs_url"`
LogsURL string `json:"logs_url"`
RunStartedAt time.Time `json:"run_started_at"`
UpdatedAt time.Time `json:"updated_at"`
CreatedAt time.Time `json:"created_at"`
Duration float64 `json:"duration"`
}
WorkflowRunSummary represents a processed workflow run
type WorkflowStatus ¶
type WorkflowStatus string
WorkflowStatus represents workflow execution status
const ( StatusCompleted WorkflowStatus = "completed" StatusInProgress WorkflowStatus = "in_progress" StatusQueued WorkflowStatus = "queued" StatusRequested WorkflowStatus = "requested" StatusWaiting WorkflowStatus = "waiting" StatusPending WorkflowStatus = "pending" )