workflow

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: 7 Imported by: 0

Documentation

Overview

Package workflow provides discovery and parsing of GitHub Actions workflow files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Discover

func Discover(repoRoot string) ([]File, []ParseFailure, error)

Discover finds all workflow files in the .github/workflows directory and returns those with workflow_dispatch triggers, plus the files it could not parse. Only an unusable workflow directory is an error.

Types

type Dispatch added in v1.0.1

type Dispatch struct {
	Inputs map[string]Input `yaml:"inputs"`
}

Dispatch represents the workflow_dispatch trigger configuration.

type File added in v1.0.1

type File struct {
	On       OnTrigger `yaml:"on"`
	Name     string    `yaml:"name"`
	Filename string    `yaml:"-"`
}

File represents a parsed GitHub Actions workflow file.

func Parse

func Parse(data []byte) (File, error)

Parse parses workflow YAML content into a File struct.

func (File) GetInputs added in v1.0.1

func (w File) GetInputs() map[string]Input

GetInputs returns the workflow inputs, or empty map if none.

func (File) IsDispatchable added in v1.0.1

func (w File) IsDispatchable() bool

IsDispatchable returns true if the workflow has workflow_dispatch trigger.

type Input added in v1.0.1

type Input struct {
	Description     string                `yaml:"description"`
	Default         string                `yaml:"default"`
	Type            string                `yaml:"type"`
	Options         []string              `yaml:"options"`
	ValidationRules []rule.ValidationRule `yaml:"-"`
	Required        bool                  `yaml:"required"`
}

Input represents a single input definition for workflow_dispatch.

func (Input) InputType added in v1.0.1

func (i Input) InputType() string

InputType returns the normalized input type, defaulting to "string".

type OnTrigger

type OnTrigger struct {
	//nolint:tagliatelle // matches GitHub Actions workflow YAML schema
	Dispatch *Dispatch `yaml:"workflow_dispatch"`
}

OnTrigger represents the "on" field which can trigger workflows.

type ParseFailure added in v1.2.0

type ParseFailure struct {
	Err      error
	Filename string
}

ParseFailure names a workflow file that could not be read or parsed. A repository holding only these looks identical to an empty one unless the failures are reported alongside the workflows.

Jump to

Keyboard shortcuts

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