config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: MIT Imports: 5 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

This section is empty.

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"` // "string", "choice", "boolean"
	Description string   `yaml:"description"`
	Options     []string `yaml:"options"` // for type: choice
	Default     string   `yaml:"default"`
	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 {
	Version int              `yaml:"version"`
	Chains  map[string]Chain `yaml:"chains"`
}

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.

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