Documentation ¶
Index ¶
- Constants
- type Action
- type ActionRuns
- type ActionRunsUsing
- type ContainerSpec
- type Defaults
- type GithubContext
- type Input
- type Job
- func (j *Job) Container() *ContainerSpec
- func (j *Job) Environment() map[string]string
- func (j *Job) GetMatrixes() []map[string]interface{}
- func (j *Job) InheritSecrets() bool
- func (j *Job) Matrix() map[string][]interface{}
- func (j *Job) Needs() []string
- func (j *Job) RunsOn() []string
- func (j *Job) Secrets() map[string]string
- func (j *Job) Type() JobType
- type JobContext
- type JobType
- type Output
- type Plan
- type Run
- type RunDefaults
- type Stage
- type Step
- type StepResult
- type StepType
- type Strategy
- type Workflow
- type WorkflowCall
- type WorkflowCallInput
- type WorkflowCallOutput
- type WorkflowDispatch
- type WorkflowDispatchInput
- type WorkflowFiles
- type WorkflowPlanner
Constants ¶
const ( // ActionRunsUsingNode12 for running with node12 ActionRunsUsingNode12 = "node12" // ActionRunsUsingNode12 for running with node16 ActionRunsUsingNode16 = "node16" // ActionRunsUsingDocker for running with docker ActionRunsUsingDocker = "docker" // ActionRunsUsingComposite for running composite ActionRunsUsingComposite = "composite" )
const ( StepStatusSuccess stepStatus = iota StepStatusFailure StepStatusSkipped )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct { Name string `yaml:"name"` Author string `yaml:"author"` Description string `yaml:"description"` Inputs map[string]Input `yaml:"inputs"` Outputs map[string]Output `yaml:"outputs"` Runs ActionRuns `yaml:"runs"` Branding struct { Color string `yaml:"color"` Icon string `yaml:"icon"` } `yaml:"branding"` }
Action describes a metadata file for GitHub actions. The metadata filename must be either action.yml or action.yaml. The data in the metadata file defines the inputs, outputs and main entrypoint for your action.
type ActionRuns ¶ added in v0.2.21
type ActionRuns struct { Using ActionRunsUsing `yaml:"using"` Env map[string]string `yaml:"env"` Main string `yaml:"main"` Pre string `yaml:"pre"` PreIf string `yaml:"pre-if"` Post string `yaml:"post"` PostIf string `yaml:"post-if"` Image string `yaml:"image"` Entrypoint string `yaml:"entrypoint"` Args []string `yaml:"args"` Steps []Step `yaml:"steps"` }
ActionRuns are a field in Action
type ActionRunsUsing ¶
type ActionRunsUsing string
ActionRunsUsing is the type of runner for the action
func (*ActionRunsUsing) UnmarshalYAML ¶ added in v0.2.9
func (a *ActionRunsUsing) UnmarshalYAML(unmarshal func(interface{}) error) error
type ContainerSpec ¶
type ContainerSpec struct { Image string `yaml:"image"` Env map[string]string `yaml:"env"` Ports []string `yaml:"ports"` Volumes []string `yaml:"volumes"` Options string `yaml:"options"` Credentials map[string]string `yaml:"credentials"` Entrypoint string Args string Name string Reuse bool }
ContainerSpec is the specification of the container to use for the job
type Defaults ¶ added in v0.2.11
type Defaults struct {
Run RunDefaults `yaml:"run"`
}
Default settings that will apply to all steps in the job or workflow
type GithubContext ¶ added in v0.2.26
type GithubContext struct { Event map[string]interface{} `json:"event"` EventPath string `json:"event_path"` Workflow string `json:"workflow"` RunID string `json:"run_id"` RunNumber string `json:"run_number"` Actor string `json:"actor"` Repository string `json:"repository"` EventName string `json:"event_name"` Sha string `json:"sha"` Ref string `json:"ref"` RefName string `json:"ref_name"` RefType string `json:"ref_type"` HeadRef string `json:"head_ref"` BaseRef string `json:"base_ref"` Token string `json:"token"` Workspace string `json:"workspace"` Action string `json:"action"` ActionPath string `json:"action_path"` ActionRef string `json:"action_ref"` ActionRepository string `json:"action_repository"` Job string `json:"job"` JobName string `json:"job_name"` RepositoryOwner string `json:"repository_owner"` RetentionDays string `json:"retention_days"` RunnerPerflog string `json:"runner_perflog"` RunnerTrackingID string `json:"runner_tracking_id"` }
func (*GithubContext) SetRefAndSha ¶ added in v0.2.26
func (ghc *GithubContext) SetRefAndSha(ctx context.Context, defaultBranch string, repoPath string)
type Input ¶
type Input struct { Description string `yaml:"description"` Required bool `yaml:"required"` Default string `yaml:"default"` }
Input parameters allow you to specify data that the action expects to use during runtime. GitHub stores input parameters as environment variables. Input ids with uppercase letters are converted to lowercase during runtime. We recommended using lowercase input ids.
type Job ¶
type Job struct { Name string `yaml:"name"` RawNeeds yaml.Node `yaml:"needs"` RawRunsOn yaml.Node `yaml:"runs-on"` Env yaml.Node `yaml:"env"` If yaml.Node `yaml:"if"` Steps []*Step `yaml:"steps"` TimeoutMinutes string `yaml:"timeout-minutes"` Services map[string]*ContainerSpec `yaml:"services"` Strategy *Strategy `yaml:"strategy"` RawContainer yaml.Node `yaml:"container"` Defaults Defaults `yaml:"defaults"` Outputs map[string]string `yaml:"outputs"` Uses string `yaml:"uses"` With map[string]interface{} `yaml:"with"` RawSecrets yaml.Node `yaml:"secrets"` Result string }
Job is the structure of one job in a workflow
func (*Job) Environment ¶ added in v0.2.23
Environments returns string-based key=value map for a job
func (*Job) GetMatrixes ¶ added in v0.2.2
GetMatrixes returns the matrix cross product It skips includes and hard fails excludes for non-existing keys
func (*Job) InheritSecrets ¶ added in v0.2.35
type JobContext ¶ added in v0.2.26
type JobType ¶ added in v0.2.34
type JobType int
JobType describes what type of job we are about to run
const ( // StepTypeRun is all steps that have a `run` attribute JobTypeDefault JobType = iota // StepTypeReusableWorkflowLocal is all steps that have a `uses` that is a local workflow in the .github/workflows directory JobTypeReusableWorkflowLocal // JobTypeReusableWorkflowRemote is all steps that have a `uses` that references a workflow file in a github repo JobTypeReusableWorkflowRemote )
type Output ¶
Output parameters allow you to declare data that an action sets. Actions that run later in a workflow can use the output data set in previously run actions. For example, if you had an action that performed the addition of two inputs (x + y = z), the action could output the sum (z) for other actions to use as an input.
type Plan ¶
type Plan struct {
Stages []*Stage
}
Plan contains a list of stages to run in series
func (*Plan) MaxRunNameLen ¶
MaxRunNameLen determines the max name length of all jobs
type RunDefaults ¶ added in v0.2.11
type RunDefaults struct { Shell string `yaml:"shell"` WorkingDirectory string `yaml:"working-directory"` }
Defaults for all run steps in the job or workflow
type Step ¶
type Step struct { ID string `yaml:"id"` If yaml.Node `yaml:"if"` Name string `yaml:"name"` Uses string `yaml:"uses"` Run string `yaml:"run"` WorkingDirectory string `yaml:"working-directory"` Shell string `yaml:"shell"` Env yaml.Node `yaml:"env"` With map[string]string `yaml:"with"` RawContinueOnError string `yaml:"continue-on-error"` TimeoutMinutes string `yaml:"timeout-minutes"` }
Step is the structure of one step in a job
func (*Step) Environment ¶ added in v0.2.23
Environments returns string-based key=value map for a step
func (*Step) ShellCommand ¶ added in v0.2.2
ShellCommand returns the command for the shell
type StepResult ¶ added in v0.2.26
type StepType ¶
type StepType int
StepType describes what type of step we are about to run
const ( // StepTypeRun is all steps that have a `run` attribute StepTypeRun StepType = iota // StepTypeUsesDockerURL is all steps that have a `uses` that is of the form `docker://...` StepTypeUsesDockerURL // StepTypeUsesActionLocal is all steps that have a `uses` that is a local action in a subdirectory StepTypeUsesActionLocal // StepTypeUsesActionRemote is all steps that have a `uses` that is a reference to a github repo StepTypeUsesActionRemote // StepTypeReusableWorkflowLocal is all steps that have a `uses` that is a local workflow in the .github/workflows directory StepTypeReusableWorkflowLocal // StepTypeReusableWorkflowRemote is all steps that have a `uses` that references a workflow file in a github repo StepTypeReusableWorkflowRemote // StepTypeInvalid is for steps that have invalid step action StepTypeInvalid )
type Strategy ¶
type Strategy struct { FailFast bool MaxParallel int FailFastString string `yaml:"fail-fast"` MaxParallelString string `yaml:"max-parallel"` RawMatrix yaml.Node `yaml:"matrix"` }
Strategy for the job
func (Strategy) GetFailFast ¶ added in v0.2.25
GetFailFast sets default and returns value for `fail-fast`
func (Strategy) GetMaxParallel ¶ added in v0.2.25
GetMaxParallel sets default and returns value for `max-parallel`
type Workflow ¶
type Workflow struct { File string Name string `yaml:"name"` RawOn yaml.Node `yaml:"on"` Env map[string]string `yaml:"env"` Jobs map[string]*Job `yaml:"jobs"` Defaults Defaults `yaml:"defaults"` }
Workflow is the structure of the files in .github/workflows
func ReadWorkflow ¶
ReadWorkflow returns a list of jobs for a given workflow file reader
func (*Workflow) WorkflowCallConfig ¶ added in v0.2.35
func (w *Workflow) WorkflowCallConfig() *WorkflowCall
func (*Workflow) WorkflowDispatchConfig ¶ added in v0.2.33
func (w *Workflow) WorkflowDispatchConfig() *WorkflowDispatch
type WorkflowCall ¶ added in v0.2.35
type WorkflowCall struct { Inputs map[string]WorkflowCallInput `yaml:"inputs"` Outputs map[string]WorkflowCallOutput `yaml:"outputs"` }
type WorkflowCallInput ¶ added in v0.2.35
type WorkflowCallOutput ¶ added in v0.2.35
type WorkflowDispatch ¶ added in v0.2.33
type WorkflowDispatch struct {
Inputs map[string]WorkflowDispatchInput `yaml:"inputs"`
}
type WorkflowDispatchInput ¶ added in v0.2.33
type WorkflowFiles ¶ added in v0.2.22
type WorkflowFiles struct {
// contains filtered or unexported fields
}
type WorkflowPlanner ¶
type WorkflowPlanner interface { PlanEvent(eventName string) *Plan PlanJob(jobName string) *Plan PlanAll() *Plan GetEvents() []string }
WorkflowPlanner contains methods for creating plans
func NewWorkflowPlanner ¶
func NewWorkflowPlanner(path string, noWorkflowRecurse bool) (WorkflowPlanner, error)
NewWorkflowPlanner will load a specific workflow, all workflows from a directory or all workflows from a directory and its subdirectories