model

package
v0.22.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 21, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package model defines the core data types for CI workflow analysis.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Job

type Job struct {
	ID              int64
	RunID           int64
	Name            string
	Status          string
	Conclusion      string
	StartedAt       time.Time
	CompletedAt     time.Time
	RunnerName      string
	RunnerGroupName string
	Labels          []string
	Steps           []Step
}

Job represents a single job within a workflow run.

func (*Job) Duration

func (j *Job) Duration() time.Duration

Duration returns the wall-clock duration of the job.

type RunDetail

type RunDetail struct {
	Run  WorkflowRun
	Jobs []Job
}

RunDetail is a fully hydrated workflow run with its jobs and steps.

func (*RunDetail) Duration

func (rd *RunDetail) Duration() time.Duration

Duration returns the wall-clock duration of the run, preferring job completion times over the run's UpdatedAt (which can be bumped by post-completion events).

type Step

type Step struct {
	Name        string
	Number      int
	Status      string
	Conclusion  string
	StartedAt   time.Time
	CompletedAt time.Time
}

Step represents a single step within a job.

func (*Step) Duration

func (s *Step) Duration() time.Duration

Duration returns the wall-clock duration of the step.

type TimePoint

type TimePoint struct {
	Time  time.Time
	Value float64
	Label string // e.g. commit SHA or run ID for context
}

TimePoint is a single observation in a time series.

type TimeSeries

type TimeSeries struct {
	Name   string
	Points []TimePoint
}

TimeSeries is a named sequence of time-value observations.

type Workflow

type Workflow struct {
	ID   int64
	Name string
	Path string
}

Workflow represents a GitHub Actions workflow definition.

type WorkflowRun

type WorkflowRun struct {
	ID           int64
	NodeID       string // GraphQL global node ID (e.g. "WFR_kwLO...")
	WorkflowID   int64
	WorkflowName string
	Name         string
	Event        string // trigger type: push, pull_request, schedule, workflow_dispatch, etc.
	Status       string
	Conclusion   string
	HeadBranch   string
	HeadSHA      string
	RunAttempt   int
	CreatedAt    time.Time
	StartedAt    time.Time
	UpdatedAt    time.Time
}

WorkflowRun represents a single execution of a workflow.

func (*WorkflowRun) Duration

func (r *WorkflowRun) Duration() time.Duration

Duration returns the wall-clock duration of the run. Returns zero if timestamps are missing or invalid.

func (*WorkflowRun) IsCompleted

func (r *WorkflowRun) IsCompleted() bool

IsCompleted reports whether the run has finished.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL