Documentation ¶
Index ¶
- Constants
- Variables
- func AnnotationSymbol(cs *iostreams.ColorScheme, a Annotation) string
- func IsFailureState(c Conclusion) bool
- func PromptForRun(cs *iostreams.ColorScheme, runs []Run) (string, error)
- func PullRequestForRun(client *api.Client, repo ghrepo.Interface, run Run) (int, error)
- func RenderAnnotations(cs *iostreams.ColorScheme, annotations []Annotation) string
- func RenderJobs(cs *iostreams.ColorScheme, jobs []Job, verbose bool) string
- func RenderRunHeader(cs *iostreams.ColorScheme, run Run, ago, prNumber string) string
- func Symbol(cs *iostreams.ColorScheme, status Status, conclusion Conclusion) (string, colorFunc)
- type Annotation
- type Artifact
- type CheckRun
- type Commit
- type Conclusion
- type FilterOptions
- type Job
- type JobsPayload
- type Level
- type Repo
- type Run
- func GetRun(client *api.Client, repo ghrepo.Interface, runID string) (*Run, error)
- func GetRunsWithFilter(client *api.Client, repo ghrepo.Interface, opts *FilterOptions, limit int, ...) ([]Run, error)
- func TestRun(id int64, s Status, c Conclusion) Run
- func TestRunWithCommit(id int64, s Status, c Conclusion, commit string) Run
- type RunsPayload
- type Status
- type Step
- type Steps
Constants ¶
View Source
const ( // Run statuses Queued Status = "queued" Completed Status = "completed" InProgress Status = "in_progress" Requested Status = "requested" Waiting Status = "waiting" // Run conclusions ActionRequired Conclusion = "action_required" Cancelled Conclusion = "cancelled" Failure Conclusion = "failure" Neutral Conclusion = "neutral" Skipped Conclusion = "skipped" Stale Conclusion = "stale" StartupFailure Conclusion = "startup_failure" Success Conclusion = "success" TimedOut Conclusion = "timed_out" AnnotationFailure Level = "failure" AnnotationWarning Level = "warning" )
Variables ¶
View Source
var FailedJobAnnotations []Annotation = []Annotation{
{
JobName: "sad job",
Message: "the job is sad",
Path: "blaze.py",
Level: "failure",
StartLine: 420,
},
}
View Source
var RunFields = []string{
"name",
"displayTitle",
"headBranch",
"headSha",
"createdAt",
"updatedAt",
"startedAt",
"status",
"conclusion",
"event",
"number",
"databaseId",
"workflowDatabaseId",
"workflowName",
"url",
}
View Source
var SingleRunFields = append(RunFields, "jobs")
View Source
var TestRunStartTime, _ = time.Parse("2006-01-02 15:04:05", "2021-02-23 04:51:00")
View Source
var TestRuns []Run = []Run{ TestRun(1, Completed, TimedOut), TestRun(2, InProgress, ""), SuccessfulRun, TestRun(4, Completed, Cancelled), FailedRun, TestRun(6, Completed, Neutral), TestRun(7, Completed, Skipped), TestRun(8, Requested, ""), TestRun(9, Queued, ""), TestRun(10, Completed, Stale), }
View Source
var TestWorkflow workflowShared.Workflow = workflowShared.Workflow{
Name: "CI",
ID: 123,
}
View Source
var WorkflowRuns []Run = []Run{ TestRun(2, InProgress, ""), SuccessfulRun, FailedRun, }
Functions ¶
func AnnotationSymbol ¶
func AnnotationSymbol(cs *iostreams.ColorScheme, a Annotation) string
func IsFailureState ¶
func IsFailureState(c Conclusion) bool
func PromptForRun ¶
func PromptForRun(cs *iostreams.ColorScheme, runs []Run) (string, error)
func PullRequestForRun ¶
func RenderAnnotations ¶
func RenderAnnotations(cs *iostreams.ColorScheme, annotations []Annotation) string
func RenderJobs ¶
func RenderJobs(cs *iostreams.ColorScheme, jobs []Job, verbose bool) string
func RenderRunHeader ¶
func RenderRunHeader(cs *iostreams.ColorScheme, run Run, ago, prNumber string) string
func Symbol ¶
func Symbol(cs *iostreams.ColorScheme, status Status, conclusion Conclusion) (string, colorFunc)
Types ¶
type Annotation ¶
type Annotation struct { JobName string Message string Path string Level Level `json:"annotation_level"` StartLine int `json:"start_line"` }
func GetAnnotations ¶
type Artifact ¶
type Conclusion ¶
type Conclusion string
type FilterOptions ¶
type Job ¶
type Job struct { ID int64 Status Status Conclusion Conclusion Name string Steps Steps StartedAt time.Time `json:"started_at"` CompletedAt time.Time `json:"completed_at"` URL string `json:"html_url"` RunID int64 `json:"run_id"` }
var FailedJob Job = Job{ ID: 20, Status: Completed, Conclusion: Failure, Name: "sad job", StartedAt: TestRunStartTime, CompletedAt: TestRunStartTime.Add(time.Minute*4 + time.Second*34), URL: "https://github.com/jobs/20", RunID: 1234, Steps: []Step{ { Name: "barf the quux", Status: Completed, Conclusion: Success, Number: 1, }, { Name: "quux the barf", Status: Completed, Conclusion: Failure, Number: 2, }, }, }
var SuccessfulJob Job = Job{ ID: 10, Status: Completed, Conclusion: Success, Name: "cool job", StartedAt: TestRunStartTime, CompletedAt: TestRunStartTime.Add(time.Minute*4 + time.Second*34), URL: "https://github.com/jobs/10", RunID: 3, Steps: []Step{ { Name: "fob the barz", Status: Completed, Conclusion: Success, Number: 1, }, { Name: "barz the fob", Status: Completed, Conclusion: Success, Number: 2, }, }, }
type JobsPayload ¶
type JobsPayload struct {
Jobs []Job
}
type Run ¶
type Run struct { Name string `json:"name"` // the semantics of this field are unclear DisplayTitle string `json:"display_title"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` StartedAt time.Time `json:"run_started_at"` Status Status Conclusion Conclusion Event string ID int64 WorkflowID int64 `json:"workflow_id"` Number int64 `json:"run_number"` Attempts uint8 `json:"run_attempt"` HeadBranch string `json:"head_branch"` JobsURL string `json:"jobs_url"` HeadCommit Commit `json:"head_commit"` HeadSha string `json:"head_sha"` URL string `json:"html_url"` HeadRepository Repo `json:"head_repository"` Jobs []Job `json:"-"` // populated by GetJobs // contains filtered or unexported fields }
func GetRunsWithFilter ¶
func GetRunsWithFilter(client *api.Client, repo ghrepo.Interface, opts *FilterOptions, limit int, f func(Run) bool) ([]Run, error)
GetRunsWithFilter fetches 50 runs from the API and filters them in-memory
func TestRunWithCommit ¶
func TestRunWithCommit(id int64, s Status, c Conclusion, commit string) Run
func (*Run) ExportData ¶
func (*Run) StartedTime ¶
func (Run) Title ¶
Title is the display title for a run, falling back to the commit subject if unavailable
func (Run) WorkflowName ¶
WorkflowName returns the human-readable name of the workflow that this run belongs to. TODO: consider lazy-loading the underlying API data to avoid extra API calls unless necessary
type RunsPayload ¶
type RunsPayload struct { TotalCount int `json:"total_count"` WorkflowRuns []Run `json:"workflow_runs"` }
func GetRuns ¶
func GetRuns(client *api.Client, repo ghrepo.Interface, opts *FilterOptions, limit int) (*RunsPayload, error)
Click to show internal directories.
Click to hide internal directories.