Documentation
¶
Index ¶
- Constants
- func FormatMessageForDebug(report *FailureReport) string
- func FormatReportForDebug(report *DigestReport) string
- func GetCommitAuthor(sha string) (string, error)
- func NewCliApp() *cli.App
- func SendSlackMessage(webhookURL string, message *SlackMessage) error
- type CommitInfo
- type Conclusion
- type DigestReport
- type FailureReport
- type Job
- type SlackBlock
- type SlackMessage
- type SlackText
- type WorkflowRun
- type WorkflowRunSummary
Constants ¶
const ( FlagRunID = "run-id" FlagSlackWebhook = "slack-webhook" FlagDryRun = "dry-run" FlagBranch = "branch" FlagDays = "days" FlagWorkflow = "workflow" )
Variables ¶
This section is empty.
Functions ¶
func FormatMessageForDebug ¶
func FormatMessageForDebug(report *FailureReport) string
FormatMessageForDebug formats the message for console output
func FormatReportForDebug ¶
func FormatReportForDebug(report *DigestReport) string
FormatReportForDebug formats the success report for console output
func GetCommitAuthor ¶
GetCommitAuthor fetches commit author using gh CLI
func SendSlackMessage ¶
func SendSlackMessage(webhookURL string, message *SlackMessage) error
SendSlackMessage sends the message to Slack webhook
Types ¶
type CommitInfo ¶
CommitInfo represents commit metadata
type Conclusion ¶
type Conclusion string
Conclusion represents the conclusion status of a workflow run or job
const ( ConclusionSuccess Conclusion = "success" ConclusionFailure Conclusion = "failure" )
type DigestReport ¶
type DigestReport struct {
Branch string
WorkflowName string
StartDate time.Time
EndDate time.Time
TotalRuns int
SuccessfulRuns int
FailedRuns int
SuccessRate float64
AverageDuration time.Duration
MedianDuration time.Duration
Under20MinutesPercent float64
Under25MinutesPercent float64
Under30MinutesPercent float64
Runs []WorkflowRunSummary
}
DigestReport aggregates success metrics for a time period
func BuildDigest ¶
func BuildDigest(branch, workflowName string, days int) (*DigestReport, error)
BuildDigest builds a digest report for the specified time range
type FailureReport ¶
type FailureReport struct {
Workflow WorkflowRun
Commit CommitInfo
FailedJobs []Job
TotalJobs int
}
FailureReport aggregates all failure information
func BuildFailureReport ¶
func BuildFailureReport(runID string) (*FailureReport, error)
BuildFailureReport aggregates all failure information
type Job ¶
type Job struct {
Name string `json:"name"`
Conclusion Conclusion `json:"conclusion"`
Status string `json:"status"`
StartedAt string `json:"startedAt"`
CompletedAt string `json:"completedAt"`
URL string `json:"url"`
}
Job represents a single job in the workflow
type SlackBlock ¶
type SlackBlock struct {
Type string `json:"type"`
Text *SlackText `json:"text,omitempty"`
Fields []SlackText `json:"fields,omitempty"`
}
SlackBlock represents a block in the Slack message
type SlackMessage ¶
type SlackMessage struct {
Text string `json:"text"`
Blocks []SlackBlock `json:"blocks"`
}
SlackMessage represents a Slack Block Kit message
func BuildFailureMessage ¶
func BuildFailureMessage(report *FailureReport) *SlackMessage
BuildFailureMessage creates a Slack message for CI failure
func BuildSuccessReportMessage ¶
func BuildSuccessReportMessage(report *DigestReport) *SlackMessage
BuildSuccessReportMessage creates a Slack message for success report
type WorkflowRun ¶
type WorkflowRun struct {
Name string `json:"name"`
Conclusion Conclusion `json:"conclusion"`
HeadBranch string `json:"headBranch"`
HeadSHA string `json:"headSha"`
URL string `json:"url"`
DisplayTitle string `json:"displayTitle"`
Event string `json:"event"`
CreatedAt time.Time `json:"createdAt"`
Jobs []Job `json:"jobs"`
}
WorkflowRun represents the GitHub workflow run information
func GetWorkflowRun ¶
func GetWorkflowRun(runID string) (*WorkflowRun, error)
GetWorkflowRun fetches workflow run details using gh CLI
type WorkflowRunSummary ¶
type WorkflowRunSummary struct {
Name string `json:"name"`
Conclusion Conclusion `json:"conclusion"`
Event string `json:"event"`
CreatedAt time.Time `json:"createdAt"`
StartedAt time.Time `json:"startedAt"`
UpdatedAt time.Time `json:"updatedAt"`
Duration time.Duration `json:"-"`
HeadSHA string `json:"headSha"`
DisplayTitle string `json:"displayTitle"`
URL string `json:"url"`
}
WorkflowRunSummary represents a workflow run for success reporting
func GetWorkflowRuns ¶
func GetWorkflowRuns(branch, workflowName string, since time.Time) ([]WorkflowRunSummary, error)
GetWorkflowRuns fetches workflow runs for a branch within a time range