Documentation
¶
Overview ¶
Package watcher provides workflow run monitoring and status tracking functionality.
Index ¶
- Constants
- type GitHubClient
- type JobStatus
- type RunUpdate
- type RunWatcher
- func (w *RunWatcher) ActiveCount() int
- func (w *RunWatcher) ClearCompleted()
- func (w *RunWatcher) GetRun(runID int64) (*WatchedRun, bool)
- func (w *RunWatcher) GetRuns() []WatchedRun
- func (w *RunWatcher) Stop()
- func (w *RunWatcher) TotalCount() int
- func (w *RunWatcher) Unwatch(runID int64)
- func (w *RunWatcher) Updates() <-chan RunUpdate
- func (w *RunWatcher) Watch(runID int64, workflowName string)
- type StepStatus
- type WatchedRun
Constants ¶
const PollInterval = 5 * time.Second
PollInterval is the default interval between API polls.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GitHubClient ¶
type GitHubClient interface {
GetWorkflowRun(runID int64) (*github.WorkflowRun, error)
GetWorkflowRunJobs(runID int64) ([]github.Job, error)
}
GitHubClient defines the interface for GitHub API operations needed by the watcher.
type JobStatus ¶
type JobStatus struct {
Name string
Status string
Conclusion string
Steps []StepStatus
}
JobStatus represents the status of a job in a watched run.
type RunUpdate ¶
type RunUpdate struct {
RunID int64
Run WatchedRun
Error error
}
RunUpdate represents an update to a watched run.
type RunWatcher ¶
type RunWatcher struct {
// contains filtered or unexported fields
}
RunWatcher monitors workflow runs and sends updates.
func NewWatcher ¶
func NewWatcher(client GitHubClient) *RunWatcher
NewWatcher creates a new RunWatcher.
func (*RunWatcher) ActiveCount ¶
func (w *RunWatcher) ActiveCount() int
ActiveCount returns the number of active runs.
func (*RunWatcher) ClearCompleted ¶
func (w *RunWatcher) ClearCompleted()
ClearCompleted removes all completed runs from the watch list.
func (*RunWatcher) GetRun ¶
func (w *RunWatcher) GetRun(runID int64) (*WatchedRun, bool)
GetRun returns a specific watched run.
func (*RunWatcher) GetRuns ¶
func (w *RunWatcher) GetRuns() []WatchedRun
GetRuns returns all currently watched runs.
func (*RunWatcher) Stop ¶
func (w *RunWatcher) Stop()
Stop stops the watcher and cleans up resources. Safe to call multiple times.
func (*RunWatcher) TotalCount ¶
func (w *RunWatcher) TotalCount() int
TotalCount returns the total number of watched runs.
func (*RunWatcher) Unwatch ¶
func (w *RunWatcher) Unwatch(runID int64)
Unwatch stops watching a workflow run.
func (*RunWatcher) Updates ¶
func (w *RunWatcher) Updates() <-chan RunUpdate
Updates returns the channel for receiving run updates.
func (*RunWatcher) Watch ¶
func (w *RunWatcher) Watch(runID int64, workflowName string)
Watch starts watching a workflow run.
type StepStatus ¶
StepStatus represents the status of a step in a job.
type WatchedRun ¶
type WatchedRun struct {
RunID int64
Workflow string
Status string
Conclusion string
Jobs []JobStatus
HTMLURL string
UpdatedAt time.Time
LastError error
}
WatchedRun represents a run being watched.
func (WatchedRun) IsActive ¶
func (r WatchedRun) IsActive() bool
IsActive returns true if the run is still in progress.
func (WatchedRun) IsSuccess ¶
func (r WatchedRun) IsSuccess() bool
IsSuccess returns true if the run completed successfully.