model

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeepEquals

func DeepEquals(a, b yaml.Node, partialMatch bool) bool

DeepEquals compares two yaml.Node values recursively. It supports scalar, mapping and sequence nodes and allows an optional partial match for mappings and sequences.

func GetDefaultDisplaySuffix

func GetDefaultDisplaySuffix(items []string) string

GetDefaultDisplaySuffix returns a string like "(foo, bar, baz)". Empty items are ignored. If all items are empty the result is "".

func GetDisplayStrings

func GetDisplayStrings(keys []string, item map[string]*yaml.Node) []string

GetDisplayStrings implements the LINQ expression:

from displayitem in keys.SelectMany(key => item[key].Traverse(true))
where !(displayitem is SequenceToken || displayitem is MappingToken)
select displayitem.ToString()

Types

type Concurrency

type Concurrency struct {
	Group            string `yaml:"group"`
	CancelInProgress bool   `yaml:"cancel-in-progress"`
}

func (*Concurrency) UnmarshalYAML

func (c *Concurrency) UnmarshalYAML(node *yaml.Node) error

type Cron

type Cron struct {
	Cron string `yaml:"cron,omitempty"`
}

type Environment

type Environment struct {
	Name string    `yaml:"name"`
	URL  yaml.Node `yaml:"url"`
}

func (*Environment) UnmarshalYAML

func (e *Environment) UnmarshalYAML(node *yaml.Node) error

type ImplicitStringArray

type ImplicitStringArray []string

func (*ImplicitStringArray) UnmarshalYAML

func (a *ImplicitStringArray) UnmarshalYAML(node *yaml.Node) error

type Input

type Input struct {
	Description string `yaml:"description,omitempty"`
	Type        string `yaml:"type,omitempty"`
	Default     string `yaml:"default,omitempty"`
	Required    bool   `yaml:"required,omitempty"`
}

type Job

type Job struct {
	Needs       ImplicitStringArray `yaml:"needs,omitempty"`
	Permissions *Permissions        `yaml:"permissions,omitempty"`
	Strategy    yaml.Node           `yaml:"strategy,omitempty"`
	Name        yaml.Node           `yaml:"name,omitempty"`
	Concurrency yaml.Node           `yaml:"concurrency,omitempty"`
	// Reusable Workflow
	Uses    yaml.Node `yaml:"uses,omitempty"`
	With    yaml.Node `yaml:"with,omitempty"`
	Secrets yaml.Node `yaml:"secrets,omitempty"`
	// Runner Job
	RunsOn         yaml.Node   `yaml:"runs-on,omitempty"`
	Defaults       yaml.Node   `yaml:"defaults,omitempty"`
	TimeoutMinutes yaml.Node   `yaml:"timeout-minutes,omitempty"`
	Container      yaml.Node   `yaml:"container,omitempty"`
	Services       yaml.Node   `yaml:"services,omitempty"`
	Env            yaml.Node   `yaml:"env,omitempty"`
	Steps          []yaml.Node `yaml:"steps,omitempty"`
	Outputs        yaml.Node   `yaml:"outputs,omitempty"`
}

type JobState

type JobState struct {
	JobID    string            // Workflow path to job, incl matrix and parent jobids
	Result   string            // Actions Job Result
	Outputs  map[string]string // Returned Outputs
	State    JobStatus
	Strategy []MatrixJobState
}

type JobStatus

type JobStatus int
const (
	JobStatusPending JobStatus = iota
	JobStatusDependenciesReady
	JobStatusBlocked
	JobStatusCompleted
)

type MatrixJobState

type MatrixJobState struct {
	Matrix  map[string]any
	Name    string
	Result  string
	Outputs map[string]string // Returned Outputs
	State   JobStatus
}

type On

type On struct {
	Data             map[string]yaml.Node `yaml:"-"`
	WorkflowDispatch *WorkflowDispatch    `yaml:"workflow_dispatch,omitempty"`
	WorkflowCall     *WorkflowCall        `yaml:"workflow_call,omitempty"`
	Schedule         []Cron               `yaml:"schedule,omitempty"`
}

func (*On) MarshalYAML

func (a *On) MarshalYAML() (interface{}, error)

func (*On) UnmarshalYAML

func (a *On) UnmarshalYAML(node *yaml.Node) error

type Output

type Output struct {
	Description string    `yaml:"description,omitempty"`
	Value       yaml.Node `yaml:"value,omitempty"`
}

type Permissions

type Permissions map[string]string

func (*Permissions) UnmarshalYAML

func (p *Permissions) UnmarshalYAML(node *yaml.Node) error

type RunsOn

type RunsOn struct {
	Labels []string `yaml:"labels"`
	Group  string   `yaml:"group,omitempty"`
}

func (*RunsOn) UnmarshalYAML

func (a *RunsOn) UnmarshalYAML(node *yaml.Node) error

type Secret

type Secret struct {
	Description string `yaml:"description,omitempty"`
	Required    bool   `yaml:"required,omitempty"`
}

type Strategy

type Strategy struct {
	Matrix      map[string][]yaml.Node `yaml:"matrix"`
	MaxParallel float64                `yaml:"max-parallel"`
	FailFast    bool                   `yaml:"fail-fast"`
}

type StrategyResult

type StrategyResult struct {
	FlatMatrix    []map[string]yaml.Node
	IncludeMatrix []map[string]yaml.Node
	FailFast      bool
	MaxParallel   *float64
	MatrixKeys    map[string]struct{}
}

StrategyResult holds the result of expanding a strategy. FlatMatrix contains the expanded matrix entries. IncludeMatrix contains entries that were added via include. FailFast indicates whether the job should fail fast. MaxParallel is the maximum parallelism allowed. MatrixKeys is the set of keys present in the matrix.

func ExpandStrategy

func ExpandStrategy(strategy *Strategy, jobTraceWriter TraceWriter) (*StrategyResult, error)

ExpandStrategy expands the given strategy into a flat matrix and include matrix. It mimics the behavior of the C# StrategyUtils. The strategy parameter is expected to be populated from a YAML mapping that follows the GitHub Actions strategy schema.

type TraceWriter

type TraceWriter interface {
	Info(format string, args ...interface{})
}

TraceWriter is an interface for logging trace information. Implementations can write to console, file, or any other sink.

type Workflow

type Workflow struct {
	On          *On            `yaml:"on,omitempty"`
	Name        string         `yaml:"name,omitempty"`
	Description string         `yaml:"description,omitempty"`
	RunName     yaml.Node      `yaml:"run-name,omitempty"`
	Permissions *Permissions   `yaml:"permissions,omitempty"`
	Env         yaml.Node      `yaml:"env,omitempty"`
	Defaults    yaml.Node      `yaml:"defaults,omitempty"`
	Concurrency yaml.Node      `yaml:"concurrency,omitempty"` // Two layouts
	Jobs        map[string]Job `yaml:"jobs,omitempty"`
}

type WorkflowCall

type WorkflowCall struct {
	Inputs  map[string]Input  `yaml:"inputs,omitempty"`
	Secrets map[string]Secret `yaml:"secrets,omitempty"`
	Outputs map[string]Output `yaml:"outputs,omitempty"`
}

type WorkflowDispatch

type WorkflowDispatch struct {
	Inputs map[string]Input `yaml:"inputs,omitempty"`
}

type WorkflowState

type WorkflowState struct {
	Name                string
	RunName             string
	Jobs                JobState
	StateWorkflowStatus WorkflowStatus
}

type WorkflowStatus

type WorkflowStatus int
const (
	WorkflowStatusPending WorkflowStatus = iota
	WorkflowStatusDependenciesReady
	WorkflowStatusBlocked
	WorkflowStatusCompleted
)

Jump to

Keyboard shortcuts

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