config

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package config provides configuration file parsing and management for workflow dispatch chains.

Index

Constants

View Source
const ConfigFilename = ".github/lazydispatch.yml"

ConfigFilename is the default name for the lazydispatch configuration file.

Variables

View Source
var ErrConfigNotFound = errors.New("config file not found")

ErrConfigNotFound indicates the configuration file does not exist at the given path.

View Source
var ErrUnsupportedConfigVersion = errors.New("unsupported config version (expected 1 or 2)")

ErrUnsupportedConfigVersion indicates the configuration file declares an unsupported version.

Functions

This section is empty.

Types

type Chain

type Chain struct {
	Description string          `yaml:"description"`
	Variables   []ChainVariable `yaml:"variables"`
	Steps       []ChainStep     `yaml:"steps"`
}

Chain represents a workflow chain definition.

type ChainStep

type ChainStep struct {
	Workflow string `yaml:"workflow"`
	//nolint:tagliatelle // documented config key, changing breaks user YAML
	WaitFor WaitCondition     `yaml:"wait_for"`
	Inputs  map[string]string `yaml:"inputs"`
	//nolint:tagliatelle // documented config key, changing breaks user YAML
	OnFailure FailureAction `yaml:"on_failure"`
}

ChainStep represents a single step in a workflow chain.

type ChainVariable

type ChainVariable struct {
	Name        string   `yaml:"name"`
	Type        string   `yaml:"type"`
	Description string   `yaml:"description"`
	Default     string   `yaml:"default"`
	Options     []string `yaml:"options"`
	Required    bool     `yaml:"required"`
}

ChainVariable represents a variable that can be set when running a chain.

type FailureAction

type FailureAction string

FailureAction specifies what to do when a step fails.

const (
	FailureAbort    FailureAction = "abort"
	FailureSkip     FailureAction = "skip"
	FailureContinue FailureAction = "continue"
)

Failure actions for a chain step.

type WaitCondition

type WaitCondition string

WaitCondition specifies when to proceed to the next step.

const (
	WaitSuccess    WaitCondition = "success"
	WaitCompletion WaitCondition = "completion"
	WaitNone       WaitCondition = "none"
)

Wait conditions for a chain step.

type WfdConfig

type WfdConfig struct {
	Chains  map[string]Chain `yaml:"chains"`
	Version int              `yaml:"version"`
}

WfdConfig represents the lazydispatch configuration file.

func Load

func Load(repoRoot string) (*WfdConfig, error)

Load loads the configuration from the default location.

func LoadFrom

func LoadFrom(path string) (*WfdConfig, error)

LoadFrom loads the configuration from a specific path. Returns ErrConfigNotFound if no file exists at path.

func (*WfdConfig) ChainNames

func (c *WfdConfig) ChainNames() []string

ChainNames returns a sorted list of chain names.

func (*WfdConfig) GetChain

func (c *WfdConfig) GetChain(name string) (*Chain, bool)

GetChain returns a chain by name.

func (*WfdConfig) HasChains

func (c *WfdConfig) HasChains() bool

HasChains returns true if any chains are defined.

Jump to

Keyboard shortcuts

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