Documentation
¶
Overview ¶
Copyright 2026 YLD Limited SPDX-License-Identifier: Apache-2.0 Package step contains the Step domain model and bidirectional serialization logic. StepConfig represents the HCL-side structure decoded via gohcl, while Step holds the normalized intermediate representation used for both HCL-to-YAML parsing and YAML-to-HCL unparsing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Comment ¶ added in v0.7.0
Comment holds the two comments one step attribute can carry: the run written on its own lines above it, and the one sharing its line.
type Comments ¶ added in v0.7.0
type Comments struct {
Head string
// Foot is the comment written at the end of the step block with nothing
// after it. It belongs to the block rather than to any one attribute.
Foot string
Attrs map[string]Comment
// Nested holds the comments on the entries of a step's "env" and "with"
// maps, keyed by the map's own key and then by the entry's.
Nested map[string]map[string]Comment
}
Comments holds the comments written on a step, keyed by the YAML key each attribute becomes, plus the one written above the step block itself.
Keyed by YAML key rather than HCL name because both directions already speak in YAML keys at the point they read this: parse is about to build the YAML mapping, and unparse has just decoded one.
type Step ¶
type Step struct {
Identifier string `yaml:"-"`
Id cty.Value `yaml:"id,omitempty" hcl:"id"`
// IgnoreId marks a step that must not be given an id on the way out.
// Unparse sets it for a step whose source YAML carried no "id", so
// converting back writes the step exactly as it was read.
IgnoreId bool `yaml:"-"`
If cty.Value `yaml:"if,omitempty" hcl:"if"`
Name cty.Value `yaml:"name,omitempty" hcl:"name"`
Uses cty.Value `yaml:"uses,omitempty" hcl:"uses"`
Run cty.Value `yaml:"run,omitempty" hcl:"run"`
WorkingDirectory cty.Value `yaml:"working-directory,omitempty" hcl:"working_directory"`
Shell cty.Value `yaml:"shell,omitempty" hcl:"shell"`
With cty.Value `yaml:"with,omitempty" hcl:"with"`
Env cty.Value `yaml:"env,omitempty" hcl:"env"`
ContinueOnError cty.Value `yaml:"continue-on-error,omitempty" hcl:"continue_on_error"`
TimeoutMinutes cty.Value `yaml:"timeout-minutes,omitempty" hcl:"timeout_minutes"`
// Comments holds what was written above and beside the step and its
// attributes. Not a field of the step as GitHub reads it, so it stays out
// of the marshalled YAML and is applied to the document separately.
Comments Comments `yaml:"-"`
}
Step holds the parsed fields of a single GitHub Actions workflow step.
type StepConfig ¶
type StepConfig struct {
Identifier string `hcl:"id,label"`
Id hcl.Expression `hcl:"id,attr"`
IgnoreId hcl.Expression `hcl:"ignore_id,attr"`
If hcl.Expression `hcl:"if,attr"`
Name hcl.Expression `hcl:"name,attr"`
Uses action.UsesListConfig `hcl:"uses,block"`
Run hcl.Expression `hcl:"run,attr"`
WorkingDirectory hcl.Expression `hcl:"working_directory,attr"`
Shell hcl.Expression `hcl:"shell,attr"`
With action.WithListConfig `hcl:"with,block"`
Env action.EnvListConfig `hcl:"env,block"`
ContinueOnError hcl.Expression `hcl:"continue_on_error,attr"`
TimeoutMinutes hcl.Expression `hcl:"timeout_minutes,attr"`
// Carried only for its source range, which is where the comment written
// above the step block is found. The decode fills it with what the
// attributes above did not take, which for a step is nothing.
Body hcl.Body `hcl:",remain"`
}
StepConfig represents the HCL configuration for a single step block.
type StepListConfig ¶
type StepListConfig []StepConfig
StepListConfig is a slice of StepConfig decoded from HCL step blocks.