Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct {
Name string `yaml:"name"`
Version string `yaml:"version"`
Description string `yaml:"description"`
Author string `yaml:"author"`
Inputs map[string]Input `yaml:"inputs"`
Outputs map[string]Output `yaml:"outputs"`
Tasks []Task `yaml:"tasks"`
}
Action is the parsed representation of an action.yml file.
func ParseAction ¶
ParseAction parses action YAML bytes into an Action.
type CacheResolver ¶
type CacheResolver struct {
CacheDir string
}
CacheResolver resolves versioned action refs from the local user cache at ~/.preflight/actions/. Refs of the form "github.com/org/name@v1.2" map to <cacheDir>/github.com/org/name@v1.2/action.yml.
func NewCacheResolver ¶
func NewCacheResolver(cacheDir string) *CacheResolver
NewCacheResolver creates a CacheResolver. If cacheDir is empty it defaults to ~/.preflight/actions/.
func (*CacheResolver) Name ¶
func (r *CacheResolver) Name() string
type Chain ¶
type Chain []Resolver
Chain tries each Resolver in order, returning the first non-nil result. If no resolver handles the ref, it returns an error.
func DefaultChain ¶
DefaultChain builds the standard resolver chain:
embedded stdlib → local ./actions/ → user cache → git (stub)
type EmbeddedResolver ¶
EmbeddedResolver resolves stdlib actions from an embedded filesystem. It handles refs with the "preflight/" prefix, mapping them to actions/preflight/<name>/action.yml inside the FS.
func NewEmbeddedResolver ¶
func NewEmbeddedResolver(fsys fs.FS) *EmbeddedResolver
NewEmbeddedResolver creates a resolver backed by the provided embedded FS.
func (*EmbeddedResolver) Name ¶
func (r *EmbeddedResolver) Name() string
Name returns a human-readable identifier for this resolver.
type GitResolver ¶
type GitResolver struct {
CacheDir string
}
GitResolver fetches action definitions from remote Git repositories. The ref format is "github.com/org/repo@version" or "github.com/org/repo@sha". This implementation is a stub — full git fetch support is a future milestone.
func NewGitResolver ¶
func NewGitResolver(cacheDir string) *GitResolver
NewGitResolver creates a GitResolver that would cache fetched actions in cacheDir.
func (*GitResolver) Name ¶
func (r *GitResolver) Name() string
type Input ¶
type Input struct {
Type string `yaml:"type"` // string, bool, int, path
Required bool `yaml:"required"`
Default any `yaml:"default"`
Description string `yaml:"description"`
}
Input describes a typed input parameter for an action.
type LocalResolver ¶
type LocalResolver struct {
BaseDir string
}
LocalResolver resolves action refs from a local project actions directory. A ref like "myorg/display-config" maps to <BaseDir>/myorg/display-config/action.yml.
Refs that look like remote URLs (contain "://", start with "github.com/", etc.) are not handled by this resolver.
func NewLocalResolver ¶
func NewLocalResolver(baseDir string) *LocalResolver
NewLocalResolver creates a resolver that looks up actions under baseDir.
func (*LocalResolver) Name ¶
func (r *LocalResolver) Name() string
Name returns a human-readable identifier for this resolver.
type LockEntry ¶
type LockEntry struct {
Ref string `json:"ref"`
SHA string `json:"sha"`
Pinned string `json:"pinned"` // original ref before SHA pinning
}
LockEntry records a pinned action reference.
type Lockfile ¶
Lockfile manages the preflight.lock file which pins remote action refs to exact Git SHAs for reproducible builds.
func LoadLockfile ¶
LoadLockfile reads and parses a lockfile from path. If the file does not exist, an empty Lockfile is returned without error.
type Playbook ¶
type Playbook struct {
Name string `yaml:"name"`
Description string `yaml:"description"`
Vars map[string]any `yaml:"vars"`
Import []string `yaml:"import"`
Tasks []Task `yaml:"tasks"`
}
Playbook is the parsed representation of a playbook.yml file.
func ParsePlaybook ¶
ParsePlaybook parses playbook YAML bytes into a Playbook.
func ParsePlaybookFile ¶
ParsePlaybookFile reads a file at path and parses it as a Playbook.
type Resolver ¶
type Resolver interface {
// Resolve returns the Action for the given ref, or (nil, nil) if this
// resolver does not handle the ref.
Resolve(ctx context.Context, ref string) (*Action, error)
// Name returns a human-readable name for this resolver (for error messages).
Name() string
}
Resolver resolves an action ref to an Action definition.
type Task ¶
type Task struct {
Name string `yaml:"name"`
Uses string `yaml:"uses"`
With map[string]any `yaml:"with"`
Module string `yaml:"-"` // resolved module name
Params map[string]any `yaml:"-"` // resolved module params
When string `yaml:"when"`
DependsOn []string `yaml:"depends_on"`
IgnoreErrors bool `yaml:"ignore_errors"`
Tags []string `yaml:"tags"`
// Inline module fields — at most one may be non-nil per task.
Registry map[string]any `yaml:"registry"`
Service map[string]any `yaml:"service"`
File map[string]any `yaml:"file"`
Directory map[string]any `yaml:"directory"`
Package map[string]any `yaml:"package"`
Shortcut map[string]any `yaml:"shortcut"`
ScheduledTask map[string]any `yaml:"scheduled_task"`
User map[string]any `yaml:"user"`
WindowsFeature map[string]any `yaml:"windows_feature"`
Environment map[string]any `yaml:"environment"`
FirewallRule map[string]any `yaml:"firewall_rule"`
Powershell map[string]any `yaml:"powershell"`
Shell map[string]any `yaml:"shell"`
Reboot map[string]any `yaml:"reboot"`
Wait map[string]any `yaml:"wait"`
}
Task is a single step inside an action or playbook.
func (*Task) ResolveModule ¶
ResolveModule inspects inline module fields and sets Module + Params. Returns an error if more than one inline module field is set, or if both "uses" and an inline module field are set.