github

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SummaryJobName is the name of the summary job
	SummaryJobName = "terraci-summary"
	// PolicyCheckJobName is the name of the policy check job
	PolicyCheckJobName = "policy-check"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Concurrency

type Concurrency struct {
	Group            string `yaml:"group"`
	CancelInProgress bool   `yaml:"cancel-in-progress"`
}

Concurrency controls concurrent runs

type Container

type Container struct {
	Image string            `yaml:"image"`
	Env   map[string]string `yaml:"env,omitempty"`
}

Container specifies a container to run the job in

type Generator

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

Generator generates GitHub Actions workflows

func NewGenerator

func NewGenerator(cfg *config.Config, depGraph *graph.DependencyGraph, modules []*discovery.Module) *Generator

NewGenerator creates a new GitHub Actions pipeline generator

func (*Generator) DryRun

func (g *Generator) DryRun(targetModules []*discovery.Module) (*pipeline.DryRunResult, error)

DryRun returns information about what would be generated without creating YAML

func (*Generator) Generate

func (g *Generator) Generate(targetModules []*discovery.Module) (pipeline.GeneratedPipeline, error)

Generate creates a GitHub Actions workflow for the given modules

func (*Generator) GenerateForChangedModules

func (g *Generator) GenerateForChangedModules(changedModuleIDs []string) (pipeline.GeneratedPipeline, error)

GenerateForChangedModules generates workflow only for changed modules and their dependents

type Job

type Job struct {
	Name        string            `yaml:"name,omitempty"`
	RunsOn      string            `yaml:"runs-on"`
	Container   *Container        `yaml:"container,omitempty"`
	Needs       []string          `yaml:"needs,omitempty"`
	If          string            `yaml:"if,omitempty"`
	Environment string            `yaml:"environment,omitempty"`
	Concurrency *Concurrency      `yaml:"concurrency,omitempty"`
	Env         map[string]string `yaml:"env,omitempty"`
	Steps       []Step            `yaml:"steps"`
}

Job represents a workflow job

type PRTrigger

type PRTrigger struct {
	Branches []string `yaml:"branches,omitempty"`
}

PRTrigger limits pull request events

type PushTrigger

type PushTrigger struct {
	Branches []string `yaml:"branches,omitempty"`
}

PushTrigger limits push events

type Step

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

Step is one step in a job

type Workflow

type Workflow struct {
	Name        string            `yaml:"name"`
	On          WorkflowTrigger   `yaml:"on"`
	Permissions map[string]string `yaml:"permissions,omitempty"`
	Env         map[string]string `yaml:"env,omitempty"`
	Concurrency *Concurrency      `yaml:"concurrency,omitempty"`
	Jobs        map[string]*Job   `yaml:"jobs"`
}

Workflow represents a GitHub Actions workflow

func (*Workflow) ToYAML

func (w *Workflow) ToYAML() ([]byte, error)

ToYAML serializes the workflow to YAML with a generated-by header

type WorkflowTrigger

type WorkflowTrigger struct {
	Push             *PushTrigger `yaml:"push,omitempty"`
	PullRequest      *PRTrigger   `yaml:"pull_request,omitempty"`
	WorkflowDispatch any          `yaml:"workflow_dispatch,omitempty"`
}

WorkflowTrigger defines when the workflow runs

Jump to

Keyboard shortcuts

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