workflow

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionMapping

type ActionMapping struct{ Mapping }

ActionMapping represents the top-level action metadata mapping.

func (ActionMapping) EachStep

func (m ActionMapping) EachStep(fn func(step StepMapping))

EachStep iterates over all steps in a composite action's runs.steps. It is a no-op for non-composite actions (where runs.steps does not exist). It silently skips malformed sections, consistent with WorkflowMapping.EachStep.

type ActionRef

type ActionRef struct {
	// contains filtered or unexported fields
}

ActionRef holds a step's "uses" value together with its source token.

func NewActionRef

func NewActionRef(value string, tk *token.Token) ActionRef

NewActionRef creates a new ActionRef.

func (ActionRef) IsDocker

func (a ActionRef) IsDocker() bool

IsDocker reports whether the action is a Docker reference (starts with "docker://").

func (ActionRef) IsLocal

func (a ActionRef) IsLocal() bool

IsLocal reports whether the action is a local path reference (starts with "./").

func (ActionRef) OwnerRepo

func (a ActionRef) OwnerRepo() (string, string)

OwnerRepo extracts the owner and repo from the action path (before "@"). Returns empty strings for local actions, Docker actions, or paths that do not contain at least owner/repo.

func (ActionRef) Ref

func (a ActionRef) Ref() git.Ref

Ref returns the git reference portion after the last "@". Returns an empty Ref if there is no "@".

func (ActionRef) RefToken

func (a ActionRef) RefToken() *token.Token

RefToken returns a token pointing to just the ref portion (after "@"). If there is no "@", it returns the full token.

func (ActionRef) String

func (a ActionRef) String() string

String returns the raw uses value (e.g. "actions/checkout@abc123").

func (ActionRef) Token

func (a ActionRef) Token() *token.Token

Token returns the source token for error reporting.

type JobMapping

type JobMapping struct{ Mapping }

JobMapping represents a job-level mapping.

type Mapping

type Mapping struct{ *ast.MappingNode }

Mapping wraps *ast.MappingNode with common navigation methods.

func (Mapping) FindKey

func (m Mapping) FindKey(key string) *ast.MappingValueNode

FindKey searches for a key in the mapping and returns the corresponding MappingValueNode, or nil if not found.

func (Mapping) FirstToken

func (m Mapping) FirstToken() *token.Token

FirstToken walks the token chain backward to the first non-comment token in the file. It returns a copy of that token with its Value trimmed to the first byte. Returns nil if the MappingNode is nil.

type StepMapping

type StepMapping struct {
	Mapping
}

StepMapping represents a step-level mapping.

func (StepMapping) Uses

func (s StepMapping) Uses() (ActionRef, bool)

Uses extracts the ActionRef from the step's "uses" key. Returns (ActionRef, false) if the step has no "uses" key or the value is not a string/literal node.

func (StepMapping) With

func (s StepMapping) With() (Mapping, bool)

With returns the "with" mapping from the step. Returns (Mapping, false) if the step has no "with" key or the value is not a mapping node.

type WorkflowMapping

type WorkflowMapping struct{ Mapping }

WorkflowMapping represents the top-level workflow mapping.

func (WorkflowMapping) EachJob added in v0.6.1

func (w WorkflowMapping) EachJob(fn func(jobKeyToken *token.Token, job JobMapping))

EachJob iterates over all jobs in the workflow. It silently skips malformed sections (missing jobs key, non-mapping values, etc.) because structural validation is handled by the required invalid-workflow rule, which gates all non-required rules.

func (WorkflowMapping) EachStep

func (w WorkflowMapping) EachStep(fn func(step StepMapping))

EachStep iterates over all steps across all jobs in the workflow. It silently skips malformed sections (missing jobs, non-mapping jobs, etc.) because structural validation is handled by the required invalid-workflow rule, which gates all non-required rules.

Jump to

Keyboard shortcuts

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