workflow

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindWorkflow

func FindWorkflow(dir string) (string, error)

FindWorkflow searches for a workflow file in the given directory. If dir contains .github/workflows/*.yml or *.yaml, the first match is returned.

Types

type Container

type Container struct {
	Image string `yaml:"image"`
}

Container specifies the OCI image to use for the job.

On Linux and Windows hosts, this is the runner container image. On macOS hosts, it is an OCI artifact image whose layers are extracted onto the per-job VM via virtio-fs.

GitHub Actions accepts both a bare string (shorthand for {image: "..."}) and a full object. The custom UnmarshalYAML below handles both forms.

func (*Container) UnmarshalYAML

func (c *Container) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML accepts either a bare string ("image:tag") or a full mapping ({image: "...", ...}) for the container field, matching GitHub Actions.

type Job

type Job struct {
	Name      string            `yaml:"name"`
	RunsOn    interface{}       `yaml:"runs-on"` // string or []string
	Env       map[string]string `yaml:"env"`
	Container Container         `yaml:"container"`
	Steps     []Step            `yaml:"steps"`
}

Job represents a single job within a workflow.

type Runner

type Runner struct {
	DataDir    string
	SocketPath string // optional: containerd socket override for isolation from the service
	Image      string // container image; empty falls back to defaultImage
	Log        *slog.Logger
}

Runner executes workflow jobs locally using embedded containerd.

func (*Runner) RunJob

func (r *Runner) RunJob(ctx context.Context, jobName string, job Job, repoDir string) error

RunJob executes a single workflow job inside a container.

type Step

type Step struct {
	Name string            `yaml:"name"`
	Uses string            `yaml:"uses"`
	Run  string            `yaml:"run"`
	With map[string]string `yaml:"with"`
	Env  map[string]string `yaml:"env"`
}

Step represents a single step within a job.

type TargetPlatform

type TargetPlatform int

TargetPlatform identifies the OS a workflow job targets.

const (
	PlatformLinux TargetPlatform = iota
	PlatformWindows
	PlatformMacOS
)

func DetectPlatform

func DetectPlatform(runsOn interface{}) TargetPlatform

DetectPlatform determines the target OS from a job's runs-on field. The runs-on value can be a string ("ubuntu-latest") or a list (["self-hosted", "linux", "x64"]). If no OS label is found, linux is assumed (matching GitHub Actions default behavior).

func (TargetPlatform) String

func (p TargetPlatform) String() string

type Workflow

type Workflow struct {
	Name string         `yaml:"name"`
	Jobs map[string]Job `yaml:"jobs"`
}

Workflow represents a parsed GitHub Actions workflow file.

func Parse

func Parse(path string) (*Workflow, error)

Parse reads and parses a GitHub Actions workflow YAML file.

Jump to

Keyboard shortcuts

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