workflow

package
v1.12.0-alpha Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MissingEngine error = errors.New("missing engine")
)

Functions

This section is empty.

Types

type CloneOpts

type CloneOpts struct {
	Skip              bool `yaml:"skip"`
	Depth             int  `yaml:"depth"`
	IncludeSubmodules bool `yaml:"submodules"`
}

func (CloneOpts) AsRecord

func (c CloneOpts) AsRecord() tangled.Pipeline_CloneOpts

type Compiler

type Compiler struct {
	Trigger     tangled.Pipeline_TriggerMetadata
	Diagnostics Diagnostics
}

func (*Compiler) Compile

func (compiler *Compiler) Compile(p Pipeline) tangled.Pipeline

convert a repositories' workflow files into a fully compiled pipeline that runners accept

func (*Compiler) Parse

func (compiler *Compiler) Parse(p RawPipeline) Pipeline

type Constraint

type Constraint struct {
	Event  StringList `yaml:"event"`
	Branch StringList `yaml:"branch"` // required for pull_request; for push, either branch or tag must be specified
	Tag    StringList `yaml:"tag"`    // optional; only applies to push events
}

func (*Constraint) Match

func (c *Constraint) Match(trigger tangled.Pipeline_TriggerMetadata) (bool, error)

func (*Constraint) MatchBranch

func (c *Constraint) MatchBranch(branch string) (bool, error)

func (*Constraint) MatchEvent

func (c *Constraint) MatchEvent(event string) bool

func (*Constraint) MatchRef

func (c *Constraint) MatchRef(ref string) (bool, error)

func (*Constraint) MatchTag

func (c *Constraint) MatchTag(tag string) (bool, error)

type Diagnostics

type Diagnostics struct {
	Errors   []Error
	Warnings []Warning
}

func (*Diagnostics) AddError

func (d *Diagnostics) AddError(path string, err error)

func (*Diagnostics) AddWarning

func (d *Diagnostics) AddWarning(path string, kind WarningKind, reason string)

func (*Diagnostics) Combine

func (d *Diagnostics) Combine(o Diagnostics)

func (*Diagnostics) IsEmpty

func (d *Diagnostics) IsEmpty() bool

func (Diagnostics) IsErr

func (d Diagnostics) IsErr() bool

type Error

type Error struct {
	Path  string
	Error error
}

func (Error) String

func (e Error) String() string

type Pipeline

type Pipeline []Workflow

type RawPipeline

type RawPipeline = []RawWorkflow

type RawWorkflow

type RawWorkflow struct {
	Name     string
	Contents []byte
}

type StringList

type StringList []string

func (*StringList) UnmarshalYAML

func (s *StringList) UnmarshalYAML(unmarshal func(any) error) error

Custom unmarshaller for StringList

type TriggerKind

type TriggerKind string
const (
	WorkflowDir = ".tangled/workflows"

	TriggerKindPush        TriggerKind = "push"
	TriggerKindPullRequest TriggerKind = "pull_request"
	TriggerKindManual      TriggerKind = "manual"
)

func (TriggerKind) String

func (t TriggerKind) String() string

type Warning

type Warning struct {
	Path   string
	Type   WarningKind
	Reason string
}

func (Warning) String

func (w Warning) String() string

type WarningKind

type WarningKind string
var (
	WorkflowSkipped      WarningKind = "workflow skipped"
	InvalidConfiguration WarningKind = "invalid configuration"
)

type Workflow

type Workflow struct {
	Name      string       `yaml:"-"` // name of the workflow file
	Engine    string       `yaml:"engine"`
	When      []Constraint `yaml:"when"`
	CloneOpts CloneOpts    `yaml:"clone"`
	Raw       string       `yaml:"-"`
}

this is simply a structural representation of the workflow file

func FromFile

func FromFile(name string, contents []byte) (Workflow, error)

func (*Workflow) Match

func (w *Workflow) Match(trigger tangled.Pipeline_TriggerMetadata) (bool, error)

if any of the constraints on a workflow is true, return true

Source Files

  • compile.go
  • def.go

Jump to

Keyboard shortcuts

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