Documentation
¶
Overview ¶
Copyright 2026 YLD Limited SPDX-License-Identifier: Apache-2.0 Package job contains GitHub job domain models and validation logic.
This package owns:
- parsed job modeling from provider parse flows,
- job-specific validation rules (uses/runs-on/steps/needs),
- strategy matrix normalization helpers.
Emission and orchestration remain in provider/github root.
Index ¶
- func NeedsFromYAML(raw any) ([]string, error)
- func NormalizeStrategyMatrix(matrix map[string]any) (map[string]any, error)
- func ValidateModel(job ValidationModel, runsOnName string) error
- func ValidateNeedsCycles(jobs map[string]ValidationModel) error
- func ValidateNeedsReferences(needs []string, jobs map[string]ValidationModel) error
- type MatrixAxis
- type MatrixVariable
- type Parsed
- type ValidationModel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NeedsFromYAML ¶
NeedsFromYAML extracts the needs list from a raw YAML value (string or list).
func NormalizeStrategyMatrix ¶
NormalizeStrategyMatrix flattens HCL "variable" blocks into top-level matrix keys.
func ValidateModel ¶
func ValidateModel(job ValidationModel, runsOnName string) error
ValidateModel checks that a job's fields are consistent (e.g. uses vs runs-on).
func ValidateNeedsCycles ¶
func ValidateNeedsCycles(jobs map[string]ValidationModel) error
ValidateNeedsCycles detects circular dependencies in the job needs graph.
func ValidateNeedsReferences ¶
func ValidateNeedsReferences(needs []string, jobs map[string]ValidationModel) error
ValidateNeedsReferences ensures all needs entries reference existing, non-duplicate jobs.
Types ¶
type MatrixAxis ¶
MatrixAxis represents a single axis (name-value pair) in a strategy matrix.
func AxesFromMap ¶
func AxesFromMap(mapping map[string]any) []MatrixAxis
AxesFromMap converts a map into a sorted slice of MatrixAxis values.
type MatrixVariable ¶
MatrixVariable represents a single named variable in a strategy matrix.
type ValidationModel ¶
type ValidationModel struct {
ID string
Uses string
HasRunsOn bool
StepCount int
HasWith bool
HasSecrets bool
Needs []string
}
ValidationModel contains the fields needed to validate a job definition.
func ModelFromParsed ¶
func ModelFromParsed(p Parsed) (ValidationModel, error)
ModelFromParsed builds a ValidationModel from a Parsed job.
func ModelFromYAML ¶
func ModelFromYAML(id string, raw map[string]any) (ValidationModel, error)
ModelFromYAML builds a ValidationModel from raw YAML job data.