Documentation
¶
Overview ¶
Package model holds the workflow file model, its YAML parsing and the contexts that an expression reads. Gitea parses a workflow into it while planning a run, the runner while executing it.
Index ¶
- Constants
- Variables
- func AsString(v any) string
- func CloneYamlNode(n yaml.Node) yaml.Node
- func CoerceInputValue(value any, inputType string) any
- func DecodeEvaluated[Value any](name string, raw yaml.Node, evaluate func(*yaml.Node) error, out *Value) error
- func MatchRunsOn(runnerLabels []string, runnerGroup string, jobLabels []string, jobGroup string) bool
- func NestedMapLookup(m map[string]any, ks ...string) (rval any)
- func ReadWorkflowNode(in io.Reader) (*yaml.Node, error)
- func RunsOnFromNode(rawRunsOn yaml.Node) []string
- func RunsOnGroupFromNode(rawRunsOn yaml.Node) string
- func RunsOnLabelsFromNode(rawRunsOn yaml.Node) []string
- func RunsOnNode(labels []string, group string) yaml.Node
- func StringifyTimestamps(node *yaml.Node)
- func UsesHash(uses string) string
- type Action
- type ActionRuns
- type ActionRunsUsing
- type ActionUses
- type ActionUsesKind
- type ContainerSpec
- type Defaults
- type GithubContext
- type Input
- type Job
- func (j *Job) Container() *ContainerSpec
- func (j *Job) DecodeRaw() error
- func (j *Job) Environment() map[string]string
- func (j *Job) GetMatrixes() ([]map[string]any, error)
- func (j *Job) InheritSecrets() bool
- func (j *Job) Matrix() (map[string][]any, error)
- func (j *Job) MatrixCombinations() ([]MatrixCombination, error)
- func (j *Job) Needs() []string
- func (j *Job) NeedsResult() string
- func (j *Job) RunsOn() []string
- func (j *Job) RunsOnGroup() string
- func (j *Job) RunsOnLabels() []string
- func (j *Job) Secrets() map[string]string
- func (j *Job) SetContinueOnError(continueOnErr bool)
- func (j *Job) Type() (JobType, error)
- func (j *Job) UnmarshalYAML(node *yaml.Node) error
- type JobContainerContext
- type JobContext
- type JobService
- type JobType
- type MatrixCombination
- type Output
- type Plan
- type RawConcurrency
- type ReusableWorkflowUses
- type Run
- type RunDefaults
- type Stage
- type Step
- func (s *Step) Clone() *Step
- func (s *Step) DecodeRaw() error
- func (s *Step) Environment() map[string]string
- func (s *Step) GetEnv() map[string]string
- func (s *Step) ShellCommand() string
- func (s *Step) String() string
- func (s *Step) Type() StepType
- func (s *Step) UnmarshalYAML(node *yaml.Node) error
- func (s *Step) UsesHash() string
- type StepResult
- type StepStatus
- type StepType
- type Strategy
- type Workflow
- func (w *Workflow) DecodeRaw() error
- func (w *Workflow) GetJob(jobID string) *Job
- func (w *Workflow) GetJobIDs() []string
- func (w *Workflow) IsWorkflowCall() bool
- func (w *Workflow) On() []string
- func (w *Workflow) OnEvent(event string) any
- func (w *Workflow) OnSchedule() []string
- func (w *Workflow) ParseWorkflowCallConfig() (*WorkflowCall, error)
- func (w *Workflow) UnmarshalYAML(node *yaml.Node) error
- func (w *Workflow) WorkflowCallConfig() *WorkflowCall
- func (w *Workflow) WorkflowDispatchConfig() *WorkflowDispatch
- func (w *Workflow) WorkflowDispatchInputs() []WorkflowDispatchInput
- type WorkflowCall
- type WorkflowCallInput
- type WorkflowCallOutput
- type WorkflowCallResult
- type WorkflowCallSecret
- type WorkflowDispatch
- type WorkflowDispatchInput
- type WorkflowFiles
- type WorkflowPlanner
Constants ¶
const ( // ActionRunsUsingNode12 for running with node12 ActionRunsUsingNode12 = "node12" // ActionRunsUsingNode16 for running with node16 ActionRunsUsingNode16 = "node16" // ActionRunsUsingNode20 for running with node20 ActionRunsUsingNode20 = "node20" // ActionRunsUsingNode24 for running with node24 ActionRunsUsingNode24 = "node24" // ActionRunsUsingDocker for running with docker ActionRunsUsingDocker = "docker" // ActionRunsUsingComposite for running composite ActionRunsUsingComposite = "composite" // ActionRunsUsingGo for running with go ActionRunsUsingGo = "go" )
const MaxMatrixCombinations = 256
MaxMatrixCombinations is GitHub's documented hard maximum of matrix combinations per job.
Variables ¶
var OnDecodeNodeError = func(node yaml.Node, out any, err error) { log.Errorf("Failed to decode node %v into %T: %v", node, out, err) }
OnDecodeNodeError is called whenever a node cannot be decoded into the model's Go type. Gitea replaces it to surface the failure to the user; the default only logs, because a library must not end its host process over a file a user wrote.
Functions ¶
func CloneYamlNode ¶
CloneYamlNode returns a deep copy of a yaml.Node so callers can evaluate it in place without mutating a node shared across parallel jobs.
func CoerceInputValue ¶ added in v1.0.0
CoerceInputValue types one `workflow_dispatch` input, whose values reach a workflow as strings, boolean being the only non-string type GitHub converts them to. It is strict: a string that is not a boolean literal stays the string it is instead of silently becoming false. Boolean strings use the YAML 1.2 canonical spellings: https://yaml.org/spec/1.2.2/#10212-boolean.
A `workflow_call` input is validated rather than coerced on GitHub, which rejects `with: {some-boolean: not-a-boolean}`, so a caller on that path wants its own check and not this function. Prefer validating against the declared type where the caller can report the error.
func DecodeEvaluated ¶ added in v1.1.0
func DecodeEvaluated[Value any](name string, raw yaml.Node, evaluate func(*yaml.Node) error, out *Value) error
DecodeEvaluated decodes out from an evaluated copy of raw.
func MatchRunsOn ¶ added in v1.1.0
func MatchRunsOn(runnerLabels []string, runnerGroup string, jobLabels []string, jobGroup string) bool
MatchRunsOn reports whether a runner satisfies runs-on, where the group only ever matches the runner's group.
func NestedMapLookup ¶
NestedMapLookup walks nested maps following the given keys and returns the value found at the end of the path, or nil if any key is missing.
func ReadWorkflowNode ¶ added in v1.1.0
ReadWorkflowNode reads the first document ready for decoding, an empty node with io.EOF when there is none.
func RunsOnFromNode ¶
RunsOnFromNode returns the labels followed by the group from a raw runs-on node.
func RunsOnGroupFromNode ¶ added in v1.0.0
RunsOnGroupFromNode parses the runner group from a raw runs-on node, empty when it declares none.
func RunsOnLabelsFromNode ¶ added in v1.0.0
RunsOnLabelsFromNode parses only the runner labels from a raw runs-on node.
func RunsOnNode ¶ added in v1.1.0
RunsOnNode is the inverse of RunsOnLabelsFromNode and RunsOnGroupFromNode.
func StringifyTimestamps ¶ added in v1.0.0
StringifyTimestamps retags every `!!timestamp` scalar in the tree as `!!str`, which is what the YAML 1.2 core schema resolves a bare date to. GitHub's workflow reader has no timestamp type, so `SDE_DATE: 2026-03-15` is a plain string there, while YAML 1.1 resolution turns it into a value that no model field accepts. Callers that parse workflow YAML themselves must apply this before decoding into the model.
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 ¶
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"`
PreEntrypoint string `yaml:"pre-entrypoint"`
Entrypoint string `yaml:"entrypoint"`
PostEntrypoint string `yaml:"post-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) IsComposite ¶
func (a ActionRunsUsing) IsComposite() bool
func (ActionRunsUsing) IsDocker ¶
func (a ActionRunsUsing) IsDocker() bool
func (ActionRunsUsing) IsNode ¶
func (a ActionRunsUsing) IsNode() bool
func (*ActionRunsUsing) UnmarshalYAML ¶
func (a *ActionRunsUsing) UnmarshalYAML(unmarshal func(any) error) error
type ActionUses ¶ added in v1.1.0
type ActionUses struct {
Kind ActionUsesKind
URL string
Owner string
Repo string
Path string
Ref string
}
ActionUses is a parsed step `uses`, URL is only set for ActionUsesURL.
func ParseActionUses ¶ added in v1.1.0
func ParseActionUses(uses string) (*ActionUses, error)
ParseActionUses parses a StepTypeUsesActionRemote `uses`, leaving the host to the consumer.
type ActionUsesKind ¶ added in v1.1.0
type ActionUsesKind int
ActionUsesKind is where a step `uses` is fetched from.
const ( ActionUsesDefault ActionUsesKind = iota // {owner}/{repo}[/{path}]@{ref} ActionUsesURL // {scheme}://{host}/{owner}/{repo}[/{path}]@{ref} ActionUsesInstance // self:{owner}/{repo}[/{path}]@{ref} ActionUsesSelfRepo // $/{path} )
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
Command string `yaml:"command"`
Args string
Name string
Reuse bool
// Gitea specific
Cmd []string `yaml:"cmd"`
}
ContainerSpec is the specification of the container to use for the job
func (*ContainerSpec) UnmarshalYAML ¶ added in v1.1.0
func (c *ContainerSpec) UnmarshalYAML(node *yaml.Node) error
UnmarshalYAML accepts an image string as shorthand, but not an unevaluated expression.
type Defaults ¶
type Defaults struct {
Run RunDefaults `yaml:"run"`
}
Defaults are the settings that apply to all steps in the job or workflow
type GithubContext ¶
type GithubContext struct {
Event map[string]any `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"`
ServerURL string `json:"server_url"`
APIURL string `json:"api_url"`
GraphQLURL string `json:"graphql_url"`
RefProtected bool `json:"ref_protected"`
TriggeringActor string `json:"triggering_actor"`
RunAttempt string `json:"run_attempt"`
ActionStatus string `json:"action_status"`
ActorID string `json:"actor_id"`
Env string `json:"env"`
Path string `json:"path"`
RepositoryID string `json:"repository_id"`
RepositoryOwnerID string `json:"repository_owner_id"`
RepositoryURL string `json:"repositoryUrl"` // GitHub spells this one in camel case
SecretSource string `json:"secret_source"`
WorkflowRef string `json:"workflow_ref"`
WorkflowSha string `json:"workflow_sha"`
}
func GithubContextFromMap ¶ added in v1.1.0
func GithubContextFromMap(values map[string]any) *GithubContext
GithubContextFromMap fills fields by json tag, skipping values of another type.
func (*GithubContext) SetBaseAndHeadRef ¶
func (ghc *GithubContext) SetBaseAndHeadRef()
func (*GithubContext) SetRefTypeAndName ¶
func (ghc *GithubContext) SetRefTypeAndName()
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"`
RawContinueOnError string `yaml:"continue-on-error"`
Services map[string]*ContainerSpec `yaml:"services"`
RawServices yaml.Node `yaml:"-"` // `services` as written, see decodeWithDeferredExpressions
Strategy *Strategy `yaml:"strategy"`
RawStrategy yaml.Node `yaml:"-"` // `strategy` as written, see decodeWithDeferredExpressions
RawContainer yaml.Node `yaml:"container"`
Defaults Defaults `yaml:"defaults"`
RawDefaults yaml.Node `yaml:"-"`
Outputs map[string]string `yaml:"outputs"`
RawOutputs yaml.Node `yaml:"-"` // `outputs` as written, see decodeWithDeferredExpressions
Uses string `yaml:"uses"`
With map[string]any `yaml:"with"`
RawWith yaml.Node `yaml:"-"` // `with` as written, see decodeWithDeferredExpressions
RawSecrets yaml.Node `yaml:"secrets"`
RawPermissions yaml.Node `yaml:"permissions"`
Result string
// Runtime fields set during execution (not from YAML):
ContinueOnError bool // true when all failing matrix combinations had continue-on-error=true
// contains filtered or unexported fields
}
Job is the structure of one job in a workflow
func (*Job) DecodeRaw ¶ added in v1.0.0
DecodeRaw updates typed fields after the caller evaluates their Raw nodes.
func (*Job) Environment ¶
Environment returns string-based key=value map for a job
func (*Job) GetMatrixes ¶
GetMatrixes expands evaluated matrix sequences in declaration order, rejecting excludes with undeclared keys.
func (*Job) InheritSecrets ¶
func (*Job) Matrix ¶
Matrix decodes the evaluated RawMatrix into its axes, include and exclude entries. Axis values must be sequences, as in GetMatrixes. Evaluate template expressions first. The returned map does not preserve the declaration order used by GetMatrixes.
func (*Job) MatrixCombinations ¶ added in v1.3.0
func (j *Job) MatrixCombinations() ([]MatrixCombination, error)
MatrixCombinations is GetMatrixes with each combination's NameValues.
func (*Job) NeedsResult ¶
NeedsResult matches GitHub's needs context, where tolerated failures are success even though the workflow stays failed.
func (*Job) RunsOnGroup ¶ added in v1.0.0
RunsOnGroup returns the runner group of the job, empty when it declares none.
func (*Job) RunsOnLabels ¶ added in v1.0.0
RunsOnLabels returns only the runner labels of the job, without its runner group.
func (*Job) SetContinueOnError ¶
SetContinueOnError records whether this combination's failure should not fail the workflow. Must be called under the job lock. Safe across parallel matrix combinations.
type JobContainerContext ¶
type JobContext ¶
type JobContext struct {
Status string `json:"status"`
Container JobContainerContext `json:"container"`
Services map[string]JobService `json:"services"`
}
type JobService ¶
type JobType ¶
type JobType int
JobType describes what type of job we are about to run
const ( // JobTypeDefault is all jobs that have a `run` attribute JobTypeDefault JobType = iota // JobTypeReusableWorkflowLocal is all jobs that have a `uses` that is a local workflow in the .github/workflows directory JobTypeReusableWorkflowLocal // JobTypeReusableWorkflowRemote is all jobs that have a `uses` that references a workflow file in a github repo JobTypeReusableWorkflowRemote // JobTypeInvalid represents a job which is not configured correctly JobTypeInvalid )
type MatrixCombination ¶ added in v1.3.0
MatrixCombination is an expanded combination with the scalars its default job name lists, in order.
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 RawConcurrency ¶
type RawConcurrency struct {
Group string `yaml:"group,omitempty"`
CancelInProgress string `yaml:"cancel-in-progress,omitempty"`
RawExpression string `yaml:"-,omitempty"`
}
RawConcurrency represents a workflow concurrency or a job concurrency with uninterpolated options
func (*RawConcurrency) MarshalYAML ¶
func (r *RawConcurrency) MarshalYAML() (any, error)
func (*RawConcurrency) UnmarshalYAML ¶
func (r *RawConcurrency) UnmarshalYAML(n *yaml.Node) error
type ReusableWorkflowUses ¶ added in v1.1.0
ReusableWorkflowUses is a parsed job `uses`, with Owner, Repo and Ref empty for a local path.
func ParseReusableWorkflowUses ¶ added in v1.1.0
func ParseReusableWorkflowUses(uses string) (*ReusableWorkflowUses, error)
ParseReusableWorkflowUses parses `./{path}`, `$/{path}`, `{owner}/{repo}/{path}@{ref}` or `self:{owner}/{repo}/{path}@{ref}`.
func (*ReusableWorkflowUses) IsLocal ¶ added in v1.1.0
func (u *ReusableWorkflowUses) IsLocal() bool
type RunDefaults ¶
type RunDefaults struct {
Shell string `yaml:"shell"`
WorkingDirectory string `yaml:"working-directory"`
}
RunDefaults are the settings that apply to all run steps in the job or workflow
type Step ¶
type Step struct {
Number int `yaml:"-"`
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"`
RawWith yaml.Node `yaml:"-"` // `with` as written, see decodeWithDeferredExpressions
RawContinueOnError string `yaml:"continue-on-error"`
TimeoutMinutes string `yaml:"timeout-minutes"`
}
Step is the structure of one step in a job
func (*Step) Clone ¶
Clone returns a deep copy so parallel matrix runs can mutate step fields and evaluate YAML independently.
func (*Step) Environment ¶
Environment returns string-based key=value map for a step
func (*Step) ShellCommand ¶
ShellCommand returns the command for the shell
func (*Step) UnmarshalYAML ¶ added in v1.0.0
UnmarshalYAML keeps a whole-value expression out of With, see decodeWithDeferredExpressions.
type StepResult ¶
type StepResult struct {
Outputs map[string]string `json:"outputs"`
Conclusion StepStatus `json:"conclusion"`
Outcome StepStatus `json:"outcome"`
}
type StepStatus ¶ added in v1.0.0
type StepStatus int
const ( StepStatusSuccess StepStatus = iota StepStatusFailure StepStatusSkipped )
func (StepStatus) MarshalText ¶ added in v1.0.0
func (s StepStatus) MarshalText() ([]byte, error)
func (StepStatus) String ¶ added in v1.0.0
func (s StepStatus) String() string
func (*StepStatus) UnmarshalText ¶ added in v1.0.0
func (s *StepStatus) UnmarshalText(b []byte) error
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 {
FailFastString string `yaml:"fail-fast"`
MaxParallelString string `yaml:"max-parallel"`
RawMatrix yaml.Node `yaml:"matrix"`
}
Strategy for the job
func (Strategy) GetFailFast ¶
GetFailFast returns `fail-fast`, defaulting to true for an omitted or invalid value, including an unevaluated expression.
func (Strategy) MaxParallel ¶
MaxParallel reads max-parallel like GitHub, a number truncated and saturated to an int32 where 0 means no limit.
func (Strategy) ParseMaxParallel
deprecated
added in
v1.0.0
type Workflow ¶
type Workflow struct {
File string
Name string `yaml:"name"`
RawOn yaml.Node `yaml:"on"`
Env map[string]string `yaml:"env"`
RawEnv yaml.Node `yaml:"-"` // `env` as written, see decodeWithDeferredExpressions
Jobs map[string]*Job `yaml:"jobs"`
Defaults Defaults `yaml:"defaults"`
RawConcurrency *RawConcurrency `yaml:"concurrency"`
RawPermissions yaml.Node `yaml:"permissions"`
}
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 ReadWorkflowPayload ¶ added in v1.2.1
ReadWorkflowPayload reads a job payload that Gitea generated from an already checked workflow, whose evaluated values may hold any text.
func (*Workflow) DecodeRaw ¶ added in v1.0.0
DecodeRaw updates Env after the caller evaluates RawEnv.
func (*Workflow) IsWorkflowCall ¶ added in v1.0.0
IsWorkflowCall reports whether the workflow can be called by another one.
func (*Workflow) OnEvent ¶
OnEvent returns the configuration of an event in an on mapping, or nil when absent.
func (*Workflow) OnSchedule ¶
func (*Workflow) ParseWorkflowCallConfig ¶ added in v1.1.0
func (w *Workflow) ParseWorkflowCallConfig() (*WorkflowCall, error)
ParseWorkflowCallConfig is WorkflowCallConfig returning an error for a missing, malformed or untyped config.
func (*Workflow) UnmarshalYAML ¶ added in v1.0.0
UnmarshalYAML keeps a whole-value expression out of Env, see decodeWithDeferredExpressions.
func (*Workflow) WorkflowCallConfig ¶
func (w *Workflow) WorkflowCallConfig() *WorkflowCall
WorkflowCallConfig returns the workflow_call configuration, or an empty configuration when absent.
func (*Workflow) WorkflowDispatchConfig ¶
func (w *Workflow) WorkflowDispatchConfig() *WorkflowDispatch
func (*Workflow) WorkflowDispatchInputs ¶ added in v1.1.0
func (w *Workflow) WorkflowDispatchInputs() []WorkflowDispatchInput
WorkflowDispatchInputs returns the inputs in declaration order, with merge keys expanded in place.
type WorkflowCall ¶
type WorkflowCall struct {
Inputs map[string]WorkflowCallInput `yaml:"inputs"`
Secrets map[string]WorkflowCallSecret `yaml:"secrets"`
Outputs map[string]WorkflowCallOutput `yaml:"outputs"`
}
func (*WorkflowCall) ValidateSecrets ¶ added in v1.1.0
func (c *WorkflowCall) ValidateSecrets(secrets map[string]string) error
ValidateSecrets checks the names of a caller's `secrets` mapping case-insensitively, like GitHub.
type WorkflowCallInput ¶
type WorkflowCallInput struct {
Description string `yaml:"description"`
Required bool `yaml:"required"`
Default string `yaml:"default"`
Type string `yaml:"type"`
}
func (WorkflowCallInput) DefaultValue ¶ added in v1.0.0
func (i WorkflowCallInput) DefaultValue() (any, error)
DefaultValue returns the input's default typed by its `type`, and GitHub's zero value for that type when the input declares no default: false for boolean, 0 for number, "" otherwise. Default holds the same value as text, which loses both the type and the difference to an absent default.
type WorkflowCallOutput ¶
type WorkflowCallResult ¶
type WorkflowCallSecret ¶ added in v1.0.0
type WorkflowCallSecret struct {
Description string `yaml:"description"`
Required bool `yaml:"required"`
}
WorkflowCallSecret is one secret of `on.workflow_call`
type WorkflowDispatch ¶
type WorkflowDispatch struct {
Inputs map[string]WorkflowDispatchInput `yaml:"inputs"`
}
type WorkflowDispatchInput ¶
type WorkflowFiles ¶
type WorkflowFiles struct {
// contains filtered or unexported fields
}
WorkflowFiles identifies a workflow directory entry and its containing directory.
type WorkflowPlanner ¶
type WorkflowPlanner interface {
PlanEvent(eventName string) (*Plan, error)
PlanJob(jobName string) (*Plan, error)
PlanAll() (*Plan, error)
GetEvents() []string
}
WorkflowPlanner contains methods for creating plans
func CombineWorkflowPlanner ¶
func CombineWorkflowPlanner(workflows ...*Workflow) WorkflowPlanner
CombineWorkflowPlanner combines workflows to a WorkflowPlanner
func NewSingleWorkflowPlanner ¶
func NewSingleWorkflowPlanner(name string, f io.Reader) (WorkflowPlanner, error)
NewSingleWorkflowPlanner reads and validates a named workflow from a reader.
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