Documentation ¶
Overview ¶
Package ghworkflow implements output to .github/workflows/ci.yaml.
Index ¶
- Constants
- func DefaultJobPermissions() map[string]string
- func DefaultServices() map[string]Service
- type Branches
- type Compiler
- type Concurrency
- type Job
- type JobStep
- func (step *JobStep) SetCommand(command string) *JobStep
- func (step *JobStep) SetConditionOnlyOnBranch(name string) *JobStep
- func (step *JobStep) SetConditions(conditions ...string) error
- func (step *JobStep) SetContinueOnError() *JobStep
- func (step *JobStep) SetCustomCondition(condition string) *JobStep
- func (step *JobStep) SetEnv(name, value string) *JobStep
- func (step *JobStep) SetID(id string) *JobStep
- func (step *JobStep) SetMakeStep(target string, args ...string) *JobStep
- func (step *JobStep) SetSudo() *JobStep
- func (step *JobStep) SetTimeoutMinutes(minutes int) *JobStep
- func (step *JobStep) SetUses(uses string) *JobStep
- func (step *JobStep) SetWith(key, value string) *JobStep
- type On
- type Output
- func (o *Output) AddJob(name string, job *Job)
- func (o *Output) AddOutputs(jobName string, outputs map[string]string)
- func (o *Output) AddSlackNotify(workflow string)
- func (o *Output) AddStep(jobName string, steps ...*JobStep)
- func (o *Output) AddStepAfter(jobName, afterStepID string, steps ...*JobStep)
- func (o *Output) AddStepBefore(jobName, beforeStepID string, steps ...*JobStep)
- func (o *Output) AddWorkflow(name string, workflow *Workflow)
- func (o *Output) Compile(compiler Compiler) error
- func (o *Output) Filenames() []string
- func (o *Output) GenerateFile(filename string, w io.Writer) error
- func (o *Output) SetOptionsForPkgs()
- func (o *Output) SetRunners(runners ...string)
- type PullRequest
- type PullRequestTarget
- type Push
- type Schedule
- type Service
- type WorkFlowRun
- type Workflow
Constants ¶
const ( // HostedRunner is the name of the hosted runner. HostedRunner = "self-hosted" // GenericRunner is the name of the generic runner. GenericRunner = "generic" // PkgsRunner is the name of the default runner for packages. PkgsRunner = "pkgs" // DefaultSkipCondition is the default condition to skip the workflow. DefaultSkipCondition = "(!startsWith(github.head_ref, 'renovate/') && !startsWith(github.head_ref, 'dependabot/'))" // IssueLabelRetrieveScript is the default script to retrieve issue labels. IssueLabelRetrieveScript = `` /* 256-byte string literal not displayed */ // SystemInfoPrintScript is the script to print system info. SystemInfoPrintScript = `` /* 669-byte string literal not displayed */ )
Variables ¶
This section is empty.
Functions ¶
func DefaultJobPermissions ¶
DefaultJobPermissions returns default job permissions.
func DefaultServices ¶
DefaultServices returns default services for the workflow.
Types ¶
type Compiler ¶
Compiler is implemented by project blocks which support GitHub Actions config generation.
type Concurrency ¶
type Concurrency struct { Group string `yaml:"group"` CancelInProgress bool `yaml:"cancel-in-progress"` }
Concurrency represents GitHub Actions concurrency.
type Job ¶
type Job struct { Permissions map[string]string `yaml:"permissions,omitempty"` RunsOn []string `yaml:"runs-on"` If string `yaml:"if,omitempty"` Needs []string `yaml:"needs,omitempty"` Outputs map[string]string `yaml:"outputs,omitempty"` Services map[string]Service `yaml:"services,omitempty"` Steps []*JobStep `yaml:"steps"` }
Job represents GitHub Actions job.
func (*Job) SetConditions ¶
SetConditions sets job conditions.
type JobStep ¶
type JobStep struct { Name string `yaml:"name"` ID string `yaml:"id,omitempty"` If string `yaml:"if,omitempty"` Uses string `yaml:"uses,omitempty"` With map[string]string `yaml:"with,omitempty"` Env map[string]string `yaml:"env,omitempty"` Run string `yaml:"run,omitempty"` ContinueOnError bool `yaml:"continue-on-error,omitempty"` TimeoutMinutes int `yaml:"timeout-minutes,omitempty"` }
JobStep represents GitHub Actions job step.
func DefaultPkgsSteps ¶
func DefaultPkgsSteps() []*JobStep
DefaultPkgsSteps returns default pkgs steps for the workflow.
func DefaultSteps ¶
func DefaultSteps() []*JobStep
DefaultSteps returns default steps for the workflow.
func (*JobStep) SetCommand ¶
SetCommand sets step command.
func (*JobStep) SetConditionOnlyOnBranch ¶
SetConditionOnlyOnBranch adds condition to run step only on a specific branch name.
func (*JobStep) SetConditions ¶
SetConditions sets step conditions.
func (*JobStep) SetContinueOnError ¶
SetContinueOnError sets step to continue on error.
func (*JobStep) SetCustomCondition ¶
SetCustomCondition sets a custom condition clearing out any previously set conditions.
func (*JobStep) SetMakeStep ¶
SetMakeStep sets step to run make command.
func (*JobStep) SetTimeoutMinutes ¶
SetTimeoutMinutes sets step timeout in minutes.
type On ¶
type On struct { Push `yaml:"push,omitempty"` PullRequest `yaml:"pull_request,omitempty"` Schedule []Schedule `yaml:"schedule,omitempty"` WorkFlowRun `yaml:"workflow_run,omitempty"` }
On represents GitHub Actions event triggers.
type Output ¶
type Output struct { output.FileAdapter // contains filtered or unexported fields }
Output implements GitHub Actions project config generation.
func (*Output) AddOutputs ¶
AddOutputs adds outputs to the job.
func (*Output) AddSlackNotify ¶
AddSlackNotify adds the workflow to notify slack dependencies.
func (*Output) AddStepAfter ¶
AddStepAfter adds step after another step in the job.
func (*Output) AddStepBefore ¶
AddStepBefore adds step before another step in the job.
func (*Output) AddWorkflow ¶
AddWorkflow adds workflow to the output.
func (*Output) Compile ¶
Compile implements output.TypedWriter interface.
func (*Output) GenerateFile ¶
GenerateFile implements output.FileWriter interface.
func (*Output) SetOptionsForPkgs ¶
func (o *Output) SetOptionsForPkgs()
SetOptionsForPkgs overwrites default job steps and services for pkgs. Note that calling this method will overwrite any existing steps.
func (*Output) SetRunners ¶
SetRunners allows to set custom runners for the default job. If runners are not provided, the default runners will be used.
type PullRequest ¶
type PullRequest struct { Branches `yaml:"branches,omitempty"` Types []string `yaml:"types,omitempty"` }
PullRequest represents GitHub Actions pull request filters.
type PullRequestTarget ¶
type PullRequestTarget struct{}
PullRequestTarget represents GitHub Actions pull request target filters.
type Schedule ¶
type Schedule struct {
Cron string `yaml:"cron"`
}
Schedule represents GitHub Actions schedule filters.
type Service ¶
type Service struct { Image string `yaml:"image"` Options string `yaml:"options,omitempty"` Ports []string `yaml:"ports,omitempty"` Volumes []string `yaml:"volumes,omitempty"` }
Service represents GitHub Actions service.
type WorkFlowRun ¶
WorkFlowRun represents GitHub Actions workflow_run filters.