Documentation ¶
Index ¶
- Constants
- Variables
- func Parse(b []byte) (*Workflow, []*Error)
- type ActionSpec
- type AnyType
- type ArrayDerefNode
- type ArrayType
- type Bool
- type BoolNode
- type BoolType
- type ByErrorPosition
- type CompareOpNode
- type CompareOpNodeKind
- type Concurrency
- type Config
- type Container
- type Credentials
- type Defaults
- type DefaultsRun
- type DispatchInput
- type Env
- type EnvVar
- type Environment
- type Error
- type Event
- type Exec
- type ExecAction
- type ExecKind
- type ExecRun
- type ExprError
- type ExprLexer
- type ExprNode
- type ExprParser
- type ExprSemanticsChecker
- type ExprType
- type Float
- type FloatNode
- type FuncCallNode
- type FuncSignature
- type IndexAccessNode
- type Input
- type Int
- type IntNode
- type Job
- type Linter
- func (l *Linter) GenerateDefaultConfig(dir string) error
- func (l *Linter) Lint(path string, content []byte, project *Project) ([]*Error, error)
- func (l *Linter) LintFile(path string) ([]*Error, error)
- func (l *Linter) LintFiles(filepaths []string) ([]*Error, error)
- func (l *Linter) LintRepository(dir string) ([]*Error, error)
- type LinterOptions
- type LogLevel
- type LogicalOpNode
- type LogicalOpNodeKind
- type Matrix
- type MatrixAssign
- type MatrixCombination
- type MatrixCombinations
- type MatrixRow
- type NotOpNode
- type NullNode
- type NullType
- type NumberType
- type ObjectDerefNode
- type ObjectType
- type Output
- type Pass
- type PermKind
- type Permission
- type Permissions
- type Pos
- type Project
- type Projects
- type RawYAMLArray
- type RawYAMLObject
- type RawYAMLString
- type RawYAMLValue
- type RawYAMLValueKind
- type RepositoryDispatchEvent
- type Rule
- type RuleAction
- type RuleBase
- func (r *RuleBase) EnableDebug(out io.Writer)
- func (r *RuleBase) Errs() []*Error
- func (r *RuleBase) Name() string
- func (r *RuleBase) VisitJobPost(node *Job) error
- func (r *RuleBase) VisitJobPre(node *Job) error
- func (r *RuleBase) VisitStep(node *Step) error
- func (r *RuleBase) VisitWorkflowPost(node *Workflow) error
- func (r *RuleBase) VisitWorkflowPre(node *Workflow) error
- type RuleCredentials
- type RuleEnvVar
- type RuleEvents
- type RuleExpression
- type RuleJobNeeds
- type RuleMatrix
- type RulePyflakes
- type RuleRunnerLabel
- type RuleShellName
- type RuleShellcheck
- type RuleStepID
- type Runner
- type ScheduledEvent
- type Service
- type Step
- type Strategy
- type String
- type StringNode
- type StringType
- type Token
- type TokenKind
- type VariableNode
- type Visitor
- type WebhookEvent
- type Workflow
- type WorkflowDispatchEvent
Constants ¶
const ( // RawYAMLValueKindObject is kind for an object value of raw YAML value. RawYAMLValueKindObject = RawYAMLValueKind(yaml.MappingNode) // RawYAMLValueKindArray is kind for an array value of raw YAML value. RawYAMLValueKindArray = RawYAMLValueKind(yaml.SequenceNode) // RawYAMLValueKindString is kind for a string value of raw YAML value. RawYAMLValueKindString = RawYAMLValueKind(yaml.ScalarNode) )
const ( // LogLevelNone does not output any log output. LogLevelNone LogLevel = 0 // LogLevelVerbose shows verbose log output. This is equivalent to specifying -verbose option // to actionlint command. LogLevelVerbose = 1 // LogLevelDebug shows all log output including debug information. LogLevelDebug = 2 )
Variables ¶
var BuiltinFuncSignatures = map[string][]*FuncSignature{ "contains": { { Name: "contains", Ret: BoolType{}, Params: []ExprType{ StringType{}, StringType{}, }, }, { Name: "contains", Ret: BoolType{}, Params: []ExprType{ &ArrayType{Elem: AnyType{}}, AnyType{}, }, }, }, "startswith": { { Name: "startsWith", Ret: BoolType{}, Params: []ExprType{ StringType{}, StringType{}, }, }, }, "endswith": { { Name: "endsWith", Ret: BoolType{}, Params: []ExprType{ StringType{}, StringType{}, }, }, }, "format": { { Name: "format", Ret: StringType{}, Params: []ExprType{ StringType{}, AnyType{}, }, VariableLengthParams: true, }, }, "join": { { Name: "join", Ret: StringType{}, Params: []ExprType{ &ArrayType{Elem: StringType{}}, StringType{}, }, }, { Name: "join", Ret: StringType{}, Params: []ExprType{ StringType{}, StringType{}, }, }, { Name: "join", Ret: StringType{}, Params: []ExprType{ &ArrayType{Elem: StringType{}}, }, }, { Name: "join", Ret: StringType{}, Params: []ExprType{ StringType{}, }, }, }, "tojson": {{ Name: "toJSON", Ret: StringType{}, Params: []ExprType{ AnyType{}, }, }}, "fromjson": {{ Name: "fromJSON", Ret: AnyType{}, Params: []ExprType{ StringType{}, }, }}, "hashfiles": {{ Name: "hashFiles", Ret: StringType{}, Params: []ExprType{ StringType{}, }, VariableLengthParams: true, }}, "success": {{ Name: "success", Ret: BoolType{}, Params: []ExprType{}, }}, "always": {{ Name: "always", Ret: BoolType{}, Params: []ExprType{}, }}, "cancelled": {{ Name: "cancelled", Ret: BoolType{}, Params: []ExprType{}, }}, "failure": {{ Name: "failure", Ret: BoolType{}, Params: []ExprType{}, }}, }
BuiltinFuncSignatures is a set of all builtin function signatures. All function names are in lower case because function names are compared in case insensitive. https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#functions
var BuiltinGlobalVariableTypes = map[string]ExprType{ "github": &ObjectType{ Props: map[string]ExprType{ "action": StringType{}, "action_path": StringType{}, "actor": StringType{}, "base_ref": StringType{}, "event": NewObjectType(), "event_name": StringType{}, "event_path": StringType{}, "head_ref": StringType{}, "job": StringType{}, "ref": StringType{}, "repository": StringType{}, "repository_owner": StringType{}, "run_id": StringType{}, "run_number": StringType{}, "sha": StringType{}, "token": StringType{}, "workflow": StringType{}, "workspace": StringType{}, "action_ref": StringType{}, "action_repository": StringType{}, "api_url": StringType{}, "env": StringType{}, "graphql_url": StringType{}, "path": StringType{}, "repositoryurl": StringType{}, "retention_days": NumberType{}, "server_url": StringType{}, }, StrictProps: true, }, "env": NewObjectType(), "job": &ObjectType{ Props: map[string]ExprType{ "container": &ObjectType{ Props: map[string]ExprType{ "id": StringType{}, "network": StringType{}, }, StrictProps: true, }, "services": NewObjectType(), "status": StringType{}, }, StrictProps: true, }, "steps": NewStrictObjectType(), "runner": &ObjectType{ Props: map[string]ExprType{ "os": StringType{}, "temp": StringType{}, "tool_cache": StringType{}, "workspace": StringType{}, }, StrictProps: true, }, "secrets": NewObjectType(), "strategy": &ObjectType{ Props: map[string]ExprType{ "fail-fast": BoolType{}, "job-index": NumberType{}, "job-total": NumberType{}, "max-parallel": NumberType{}, }, }, "matrix": NewStrictObjectType(), "needs": NewStrictObjectType(), }
BuiltinGlobalVariableTypes defines types of all global variables. All context variables are documented at https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#contexts
Functions ¶
Types ¶
type ActionSpec ¶
type ActionSpec struct { // Name is "name" field of action.yaml Name string `yaml:"name"` // Inputs is "inputs" field of action.yaml Inputs map[string]struct { Required bool `yaml:"required"` Default *string `yaml:"default"` } `yaml:"inputs"` // Outputs is "outputs" field of action.yaml Outputs map[string]struct{} `yaml:"outputs"` }
ActionSpec represents structure of action.yaml. https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions
type AnyType ¶
type AnyType struct{}
AnyType represents type which can be any type. It also indicates that a value of the type cannot be type-checked since it's type cannot be known statically.
func (AnyType) Assignable ¶
Assignable returns if other type can be assignable to the type.
type ArrayDerefNode ¶
type ArrayDerefNode struct { // Receiver is an expression at receiver of array element dereference. Receiver ExprNode }
ArrayDerefNode represents elements dereference of arrays like '*' in 'foo.bar.*.piyo'.
func (ArrayDerefNode) Token ¶
func (n ArrayDerefNode) Token() *Token
Token returns the first token of the node. This method is useful to get position of this node.
type ArrayType ¶
type ArrayType struct { // Elem is type of element of the array. Elem ExprType // Deref is true when this type was derived from array filter syntax (foo.*). Deref bool }
ArrayType is type for arrays.
func (*ArrayType) Assignable ¶
Assignable returns if other type can be assignable to the type.
func (*ArrayType) Fuse ¶
Fuse merges two object types into one. When other object has unknown props, they are merged into current object. When both have same property, when they are assignable, it remains as-is. Otherwise, the property falls back to any type. Note that this method modifies itself destructively for efficiency.
type Bool ¶
type Bool struct { // Value is a raw value of the bool string. Value bool // Expression is a string when expression syntax ${{ }} is used for this section. Expression *String // Pos is a position in source. Pos *Pos }
Bool represents generic boolean value in YAML file with position.
type BoolNode ¶
type BoolNode struct { // Value is value of the boolean literal. Value bool // contains filtered or unexported fields }
BoolNode is node for boolean literal, true or false.
type BoolType ¶
type BoolType struct{}
BoolType is type for boolean values.
func (BoolType) Assignable ¶
Assignable returns if other type can be assignable to the type.
type ByErrorPosition ¶ added in v1.1.2
type ByErrorPosition []*Error
ByErrorPosition is type for sort.Interface. It sorts errors slice in line and column order.
func (ByErrorPosition) Len ¶ added in v1.1.2
func (by ByErrorPosition) Len() int
func (ByErrorPosition) Less ¶ added in v1.1.2
func (by ByErrorPosition) Less(i, j int) bool
func (ByErrorPosition) Swap ¶ added in v1.1.2
func (by ByErrorPosition) Swap(i, j int)
type CompareOpNode ¶
type CompareOpNode struct { // Kind is a kind of this expression to show which operator is used. Kind CompareOpNodeKind // Left is an expression for left hand side of the binary operator. Left ExprNode // Right is an expression for right hand side of the binary operator. Right ExprNode }
CompareOpNode is node for binary expression to compare values; ==, !=, <, <=, > or >=.
func (*CompareOpNode) Token ¶
func (n *CompareOpNode) Token() *Token
Token returns the first token of the node. This method is useful to get position of this node.
type CompareOpNodeKind ¶
type CompareOpNodeKind int
CompareOpNodeKind is a kind of compare operators; ==, !=, <, <=, >, >=.
const ( // CompareOpNodeKindInvalid is invalid and initial value of CompareOpNodeKind values. CompareOpNodeKindInvalid CompareOpNodeKind = iota // CompareOpNodeKindLess is kind for < operator. CompareOpNodeKindLess // CompareOpNodeKindLessEq is kind for <= operator. CompareOpNodeKindLessEq // CompareOpNodeKindGreater is kind for > operator. CompareOpNodeKindGreater // CompareOpNodeKindGreaterEq is kind for >= operator. CompareOpNodeKindGreaterEq // CompareOpNodeKindEq is kind for == operator. CompareOpNodeKindEq // CompareOpNodeKindNotEq is kind for != operator. CompareOpNodeKindNotEq )
type Concurrency ¶
type Concurrency struct { // Group is name of the concurrency group. Group *String // CancelInProgress is a flag that shows if canceling this workflow cancels other jobs in progress. CancelInProgress *Bool // Pos is a position in source. Pos *Pos }
Concurrency is a configuration of concurrency of the workflow. https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency
type Config ¶
type Config struct { // SelfHostedRunner is configuration for self-hosted runner. SelfHostedRunner struct { // Labels is label names for self-hosted runner. Labels []string `yaml:"labels"` } `yaml:"self-hosted-runner"` }
Config is configuration of actionlint. This struct instance is parsed from "actionlint.yaml" file usually put in ".github" directory.
type Container ¶
type Container struct { // Image is specification of Docker image. // https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idcontainerimage Image *String // Credentials is credentials configuration of the Docker container. Credentials *Credentials // Env is environment variables setup in the container. // https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idcontainerenv Env *Env // Ports is list of port number mappings of the container. // https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idcontainerports Ports []*String // Volumes are list of volumes to be mounted to the container. // https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idcontainervolumes Volumes []*String // Options is options string to run the container. // https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idcontaineroptions Options *String // Pos is a position in source. Pos *Pos }
Container is configuration of how to run the container. https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idcontainer
type Credentials ¶
type Credentials struct { // Username is username for authentication. Username *String // Password is password for authentication. Password *String // Pos is a position in source. Pos *Pos }
Credentials is credentials configuration. https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idcontainercredentials
type Defaults ¶
type Defaults struct { // Run is configuration of how to run shell. Run *DefaultsRun // Pos is a position in source. Pos *Pos }
Defaults is set of default configurations to run shell. https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#defaults
type DefaultsRun ¶
type DefaultsRun struct { // Shell is shell name to be run. Shell *String // WorkingDirectory is a default working directory path. WorkingDirectory *String // Pos is a position in source. Pos *Pos }
DefaultsRun is configuration that shell is how to be run. https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#defaultsrun
type DispatchInput ¶
type DispatchInput struct { // Name is a name of input value specified on dispatching workflow manually. Name *String // Description is a description of input value specified on dispatching workflow manually. Description *String // Required is a flag to show if this input is mandatory or not on dispatching workflow manually. Required *Bool // Default is a default value of input value on dispatching workflow manually. Default *String }
DispatchInput is input specified on dispatching workflow manually. https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_dispatch
type Env ¶
type Env struct { // Vars is mapping from env var name to env var value. Vars map[string]*EnvVar // Expression is an expression string which contains ${{ ... }}. When this value is not empty, // Vars should be nil. Expression *String }
Env represents set of environment variables.
type EnvVar ¶
type EnvVar struct { // Name is name of the environment variable. Name *String // Value is string value of the environment variable. Value *String }
EnvVar represents key-value of environment variable setup.
type Environment ¶
type Environment struct { // Name is a name of environment which the workflow uses. Name *String // URL is the URL mapped to 'environment_url' in the deployments API. Empty value means no value was specified. URL *String // Pos is a position in source. Pos *Pos }
Environment is a configuration of environment. https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idenvironment
type Error ¶
type Error struct { // Message is an error message. Message string // Filepath is a file path where the error occurred. Filepath string // Line is a line number where the error occurred. This value is 1-based. Line int // Column is a column number where the error occurred. This value is 1-based. Column int // Kind is a string to represent kind of the error. Usually rule name which found the error. Kind string }
Error represents an error detected by actionlint rules
func (*Error) PrettyPrint ¶
PrettyPrint prints the error with user-friendly way. It prints file name, source position, error message with colorful output and source snippet with indicator. When nil is set to source, no source snippet is not printed. To disable colorful output, set true to fatih/color.NoColor.
type Event ¶
type Event interface { // EventName returns name of the event to trigger this workflow. EventName() string }
Event interface represents workflow events in 'on' section
type Exec ¶
type Exec interface { // Kind returns kind of the step execution. Kind() ExecKind // SetWorkingDir sets working-directory section. SetWorkingDir(d *String) }
Exec is an interface how the step is executed. Step in workflow runs either an action or a script
type ExecAction ¶
type ExecAction struct { // https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepsuses Uses *String // Inputs represents inputs to the action to execute in 'with' section Inputs map[string]*Input // Entrypoint represents optional 'entrypoint' field in 'with' section. Nil field means nothing specified // https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepswithentrypoint Entrypoint *String // Args represents optional 'args' field in 'with' section. Nil field means nothing specified // https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepswithargs Args *String // WorkingDirectory is a default working directory path to run action WorkingDirectory *String }
ExecAction is configuration how to run action at the step. https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepsuses
func (*ExecAction) Kind ¶
func (r *ExecAction) Kind() ExecKind
Kind returns kind of the step execution.
func (*ExecAction) SetWorkingDir ¶
func (e *ExecAction) SetWorkingDir(dir *String)
SetWorkingDir sets working-directory section.
type ExecKind ¶
type ExecKind uint8
ExecKind is kind of how the step is executed. A step runs some action or runs some shell script.
type ExecRun ¶
type ExecRun struct { // Run is script to run. Run *String // Shell represents optional 'shell' field. Nil means nothing specified. Shell *String // WorkingDirectory represents optional 'working-directory' field. Nil means nothing specified. WorkingDirectory *String // RunPos is position of 'run' section RunPos *Pos }
ExecRun is configuration how to run shell script at the step. https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepsrun
func (*ExecRun) SetWorkingDir ¶
SetWorkingDir sets working-directory section.
type ExprError ¶
type ExprError struct { // Message is an error message Message string // Offset is byte offset position which caused the error Offset int // Offset is line number position which caused the error. Note that this value is 1-based. Line int // Column is column number position which caused the error. Note that this value is 1-based. Column int }
ExprError is an error type caused by lexing/parsing expression syntax. For more details, see https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions
type ExprLexer ¶
type ExprLexer struct {
// contains filtered or unexported fields
}
ExprLexer is a struct to lex expression syntax. To know the syntax, see https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions
type ExprNode ¶
type ExprNode interface { // Token returns the first token of the node. This method is useful to get position of this node. Token() *Token }
ExprNode is a node of expression syntax tree. To know the syntax, see https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions
type ExprParser ¶
type ExprParser struct {
// contains filtered or unexported fields
}
ExprParser is a parser for expression syntax. To know the details, see https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions
func NewExprParser ¶
func NewExprParser() *ExprParser
NewExprParser creates new ExprParser instance.
type ExprSemanticsChecker ¶
type ExprSemanticsChecker struct {
// contains filtered or unexported fields
}
ExprSemanticsChecker is a semantics checker for expression syntax. It checks types of values in given expression syntax tree. It additionally checks other semantics like arguments of format() built-in function. To know the details of the syntax, see https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#contexts
func NewExprSemanticsChecker ¶
func NewExprSemanticsChecker() *ExprSemanticsChecker
NewExprSemanticsChecker creates new ExprSemanticsChecker instance.
func (*ExprSemanticsChecker) Check ¶
func (sema *ExprSemanticsChecker) Check(expr ExprNode) (ExprType, []*ExprError)
Check checks sematics of given expression syntax tree. It returns the type of the expression as the first return value when the check was successfully done. And it returns all errors found while checking the expression as the second return value.
func (*ExprSemanticsChecker) UpdateMatrix ¶
func (sema *ExprSemanticsChecker) UpdateMatrix(ty *ObjectType)
UpdateMatrix updates matrix object to given object type. Since matrix values change according to 'matrix' section of job configuration, the type needs to be updated.
func (*ExprSemanticsChecker) UpdateNeeds ¶
func (sema *ExprSemanticsChecker) UpdateNeeds(ty *ObjectType)
UpdateNeeds updates 'needs' context object to given object type.
func (*ExprSemanticsChecker) UpdateSteps ¶
func (sema *ExprSemanticsChecker) UpdateSteps(ty *ObjectType)
UpdateSteps updates 'steps' context object to given object type.
type ExprType ¶
type ExprType interface { // String returns string representation of the type. String() string // Assignable returns if other type can be assignable to the type. Assignable(other ExprType) bool // Equals returns if the type is equal to the other type. Equals(other ExprType) bool // Fuse merges other type into this type. When other type conflicts with this type, fused // result is any type as fallback. Fuse(other ExprType) ExprType }
ExprType is interface for types of values in expression.
func ElemTypeOf ¶
ElemTypeOf returns element type of given type when it is array type. When it is any type, it returns any type. Otherwise ti returns nil.
type Float ¶
type Float struct { // Value is a raw value of the float string. Value float64 // Expression is a string when expression syntax ${{ }} is used for this section. Expression *String // Pos is a position in source. Pos *Pos }
Float represents generic float value in YAML file with position.
type FloatNode ¶
type FloatNode struct { // Value is value of the float literal. Value float64 // contains filtered or unexported fields }
FloatNode is node for float literal.
type FuncCallNode ¶
type FuncCallNode struct { // Callee is a name of called function. This is string value because currently only built-in // functions can be called. Callee string // Args is arguments of the function call. Args []ExprNode // contains filtered or unexported fields }
FuncCallNode represents function call in expression. Note that currently only calling builtin functions is supported.
func (*FuncCallNode) Token ¶
func (n *FuncCallNode) Token() *Token
Token returns the first token of the node. This method is useful to get position of this node.
type FuncSignature ¶
type FuncSignature struct { // Name is a name of the function. Name string // Ret is a return type of the function. Ret ExprType // Params is a list of parameter types of the function. The final element of this list might // be repeated as variable length arguments. Params []ExprType // VariableLengthParams is a flag to handle variable length parameters. When this flag is set to // true, it means that the last type of params might be specified multiple times (including zero // times). Setting true implies length of Params is more than 0. VariableLengthParams bool }
FuncSignature is a signature of function, which holds return and arguments types.
func (*FuncSignature) String ¶
func (sig *FuncSignature) String() string
type IndexAccessNode ¶
type IndexAccessNode struct { // Operand is an expression at operand of index access, which should be array or object. Operand ExprNode // Index is an expression at index, which should be integer or string. Index ExprNode }
IndexAccessNode is node for index access, which represents dynamic object property access or array index access.
func (*IndexAccessNode) Token ¶
func (n *IndexAccessNode) Token() *Token
Token returns the first token of the node. This method is useful to get position of this node.
type Input ¶
type Input struct { // Name is a name of the input. Name *String // Value is a value of the input. Value *String }
Input is an input field for running an action. https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepswith
type Int ¶
type Int struct { // Value is a raw value of the integer string. Value int // Expression is a string when expression syntax ${{ }} is used for this section. Expression *String // Pos is a position in source. Pos *Pos }
Int represents generic integer value in YAML file with position.
type IntNode ¶
type IntNode struct { // Value is value of the integer literal. Value int // contains filtered or unexported fields }
IntNode is node for integer literal.
type Job ¶
type Job struct { // ID is an ID of the job, which is key of job configuration objects. // https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_id ID *String // Name is a name of job that user can specify freely. // https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idname Name *String // Needs is list of job IDs which should be run before running this job. // https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idneeds Needs []*String // RunsOn is runner configuration which run the job. // https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on RunsOn *Runner // Permissions is permission configuration for running the job. Permissions *Permissions // Environment is environment specification where the job runs. Environment *Environment // Concurrency is concurrency configuration on running the job. Concurrency *Concurrency // Outputs is map from output name to output specifications. // https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idoutputs Outputs map[string]*Output // Env is environment variables setup while running the job. // https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idenv Env *Env // Defaults is default configurations of how to run scripts. Defaults *Defaults // If is a condition whether this job should be run. // https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idif If *String // Steps is list of steps to be run in the job. // https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idsteps Steps []*Step // TimeoutMinutes is timeout value of running the job in minutes. // https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idtimeout-minutes TimeoutMinutes *Float // Strategy is strategy configuration of running the job. // https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstrategy Strategy *Strategy // ContinueOnError is a flag to show if execution should continue on error. // https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idcontinue-on-error ContinueOnError *Bool // Container is container configuration to run the job. Container *Container // Services is map from service names to service configurations. // https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idservices Services map[string]*Service // Pos is a position in source. Pos *Pos }
Job is configuration of how to run a job. https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobs
type Linter ¶
type Linter struct {
// contains filtered or unexported fields
}
Linter is struct to lint workflow files.
func NewLinter ¶
func NewLinter(out io.Writer, opts *LinterOptions) (*Linter, error)
NewLinter creates a new Linter instance. The out parameter is used to output errors from Linter instance. Set io.Discard if you don't want the outputs. The opts parameter is LinterOptions instance which configures behavior of linting.
func (*Linter) GenerateDefaultConfig ¶
GenerateDefaultConfig generates default config file at ".github/actionlint.yaml" in project which the given directory path belongs to.
func (*Linter) Lint ¶
Lint lints YAML workflow file content given as byte sequence. The path parameter is used as file path the content came from. Setting "<stdin>" to path parameter indicates the output came from STDIN. Note that only given Project instance is used for configuration. No config is automatically loaded based on path parameter.
func (*Linter) LintFile ¶
LintFile lints one YAML workflow file and outputs the errors to given writer.
func (*Linter) LintFiles ¶
LintFiles lints YAML workflow files and outputs the errors to given writer. It applies lint rules to all given files.
func (*Linter) LintRepository ¶
LintRepository lints YAML workflow files and outputs the errors to given writer. It finds the nearest `.github/workflow` directory based on `dir` and applies lint rules to all YAML worflow files under the directory.
type LinterOptions ¶
type LinterOptions struct { // Verbose is flag if verbose log output is enabled. Verbose bool // Debug is flag if debug log output is enabled. Debug bool // LogWriter is io.Writer object to use to print log outputs. Note that error outputs detected // by the linter are not included in the log outputs. LogWriter io.Writer // NoColor is flag if colorful output is enabled. NoColor bool // Oneline is flag if one line output is enabled. When enabling it, one error is output per one // line. It is useful when reading outputs from programs. Oneline bool // Shellcheck is executable for running shellcheck external command. It can be command name like // "shellcheck" or file path like "/path/to/shellcheck", "path/to/shellcheck". When this value // is empty, shellcheck won't run to check scripts in workflow file. Shellcheck string // Pyflakes is executable for running pyflakes external command. It can be command name like "pyflakes" // or file path like "/path/to/pyflakes", "path/to/pyflakes". When this value is empty, pyflakes // won't run to check scripts in workflow file. Pyflakes string // IgnorePatterns is list of regular expression to filter errors. The pattern is applied to error // messages. When an error is matched, the error is ignored. IgnorePatterns []string // ConfigFile is a path to config file. Empty string means no config file path is given. In // the case, actionlint will try to read config from .github/actionlint.yaml. ConfigFile string }
LinterOptions is set of options for Linter instance. This struct should be created by user and given to NewLinter factory function.
type LogicalOpNode ¶
type LogicalOpNode struct { // Kind is a kind to show which operator is used. Kind LogicalOpNodeKind // Left is an expression for left hand side of the binary operator. Left ExprNode // Right is an expression for right hand side of the binary operator. Right ExprNode }
LogicalOpNode is node for logical binary operators; && or ||.
func (*LogicalOpNode) Token ¶
func (n *LogicalOpNode) Token() *Token
Token returns the first token of the node. This method is useful to get position of this node.
type LogicalOpNodeKind ¶
type LogicalOpNodeKind int
LogicalOpNodeKind is a kind of logical operators; && and ||.
const ( // LogicalOpNodeKindInvalid is an invalid and initial value of LogicalOpNodeKind. LogicalOpNodeKindInvalid LogicalOpNodeKind = iota // LogicalOpNodeKindAnd is a kind for && operator. LogicalOpNodeKindAnd // LogicalOpNodeKindOr is a kind for || operator. LogicalOpNodeKindOr )
func (LogicalOpNodeKind) String ¶
func (k LogicalOpNodeKind) String() string
type Matrix ¶
type Matrix struct { // Values stores mappings from name to values. Rows map[string]*MatrixRow // Include is list of combinations of matrix values and additional values on running matrix combinations. // https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#example-including-additional-values-into-combinations Include *MatrixCombinations // Exclude is list of combinations of matrix values which should not be run. Combinations in // this list will be removed from combinations of matrix to run. // https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#example-excluding-configurations-from-a-matrix Exclude *MatrixCombinations // Expression is a string when expression syntax ${{ }} is used for this section. Expression *String // Pos is a position in source. Pos *Pos }
Matrix is matrix variations configuration of a job. https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix
type MatrixAssign ¶
type MatrixAssign struct { // Key is a name of the matrix value. Key *String // Value is the value selected from values in row. Value RawYAMLValue }
MatrixAssign represents which value should be taken in the row of the matrix. https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix
type MatrixCombination ¶
type MatrixCombination struct { Assigns map[string]*MatrixAssign // Expression is a string when expression syntax ${{ }} is used for this section. Expression *String }
MatrixCombination is combination of matrix value assignments to define one of matrix variations. https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix
type MatrixCombinations ¶
type MatrixCombinations struct { Combinations []*MatrixCombination // Expression is a string when expression syntax ${{ }} is used for this section. Expression *String }
MatrixCombinations is list of combinations of matrix assignments used for 'include' and 'exclude' sections. https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix
func (*MatrixCombinations) ContainsExpression ¶
func (cs *MatrixCombinations) ContainsExpression() bool
ContainsExpression returns if the combinations section includes at least one expression node.
type MatrixRow ¶
type MatrixRow struct { // Name is a name of matrix value. Name *String // Values is variations of values which the matrix value can take. Values []RawYAMLValue // Expression is a string when expression syntax ${{ }} is used for this section. Expression *String }
MatrixRow is one row of matrix. One matrix row can take multiple values. Those variations are stored as row of values in this struct. https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix
type NotOpNode ¶
type NotOpNode struct { // Operand is an expression at operand of ! operator. Operand ExprNode // contains filtered or unexported fields }
NotOpNode is node for unary ! operator.
type NullNode ¶
type NullNode struct {
// contains filtered or unexported fields
}
NullNode is node for null literal.
type NullType ¶
type NullType struct{}
NullType is type for null value.
func (NullType) Assignable ¶
Assignable returns if other type can be assignable to the type.
type NumberType ¶
type NumberType struct{}
NumberType is type for number values such as integer or float.
func (NumberType) Assignable ¶
func (ty NumberType) Assignable(other ExprType) bool
Assignable returns if other type can be assignable to the type.
func (NumberType) Equals ¶
func (ty NumberType) Equals(other ExprType) bool
Equals returns if the type is equal to the other type.
func (NumberType) Fuse ¶
func (ty NumberType) Fuse(other ExprType) ExprType
Fuse merges other type into this type. When other type conflicts with this type, fused result is any type as fallback.
func (NumberType) String ¶
func (ty NumberType) String() string
type ObjectDerefNode ¶
type ObjectDerefNode struct { // Receiver is an expression at receiver of property dereference. Receiver ExprNode // Property is a name of property to access. Property string }
ObjectDerefNode represents property dereference of object like 'foo.bar'.
func (ObjectDerefNode) Token ¶
func (n ObjectDerefNode) Token() *Token
Token returns the first token of the node. This method is useful to get position of this node.
type ObjectType ¶
type ObjectType struct { // Props is map from properties name to their type. Props map[string]ExprType // StrictProps is flag to check if the properties should be checked strictly. When this flag // is set to true, it means that other than properties defined in Props field are not permitted // and will cause type error. When this flag is set to false, accessing to unknown properties // does not cause type error and will be deducted to any type. StrictProps bool }
ObjectType is type for objects, which can hold key-values.
func NewObjectType ¶
func NewObjectType() *ObjectType
NewObjectType creates new ObjectType instance which allows unknown props. When accessing to unknown props, their values will fall back to any.
func NewStrictObjectType ¶
func NewStrictObjectType() *ObjectType
NewStrictObjectType creates new ObjectType instance which does not allow unknown props.
func (*ObjectType) Assignable ¶
func (ty *ObjectType) Assignable(other ExprType) bool
Assignable returns if other type can be assignable to the type.
func (*ObjectType) Equals ¶
func (ty *ObjectType) Equals(other ExprType) bool
Equals returns if the type is equal to the other type.
func (*ObjectType) Fuse ¶
func (ty *ObjectType) Fuse(other ExprType) ExprType
Fuse merges two object types into one. When other object has unknown props, they are merged into current object. When both have same property, when they are assignable, it remains as-is. Otherwise, the property falls back to any type. Note that this method modifies itself destructively for efficiency.
func (*ObjectType) String ¶
func (ty *ObjectType) String() string
type Output ¶
type Output struct { // Name is name of output. Name *String // Value is value of output. Value *String }
Output is output entry of the job. https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idoutputs
type Pass ¶
type Pass interface { // VisitStep is callback when visiting Step node. It returns internal error when it cannot continue the process VisitStep(node *Step) error // VisitJobPre is callback when visiting Job node before visiting its children. It returns internal error when it cannot continue the process VisitJobPre(node *Job) error // VisitJobPost is callback when visiting Job node after visiting its children. It returns internal error when it cannot continue the process VisitJobPost(node *Job) error // VisitWorkflowPre is callback when visiting Workflow node before visiting its children. It returns internal error when it cannot continue the process VisitWorkflowPre(node *Workflow) error // VisitWorkflowPost is callback when visiting Workflow node after visiting its children. It returns internal error when it cannot continue the process VisitWorkflowPost(node *Workflow) error }
Pass is an interface to traverse a workflow syntax tree
type PermKind ¶
type PermKind uint8
PermKind is kind of permissions. https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#permissions
const ( // PermKindNone represents 'none' permission. No operation is permitted. PermKindNone PermKind = iota // PermKindRead represents 'read' permission. Only read operations are permitted. PermKindRead // PermKindWrite represents 'write' permission. Both read and write operations are permitted. PermKindWrite )
type Permission ¶
type Permission struct { // Name is name of permission. This value is nil when it represents all scopes (read-all or write-all) Name *String // Kind is kind of the permission configured in workflow. Kind PermKind // Pos is a position in source. Pos *Pos }
Permission is configuration for permissions.
type Permissions ¶
type Permissions struct { // All represents read-all or write-all, which define permissions of all scopes at once. All *Permission // Scopes is mappings from permission name to permission value Scopes map[string]*Permission // Pos is a position in source. Pos *Pos }
Permissions is set of permission configurations in workflow file. All permissions can be set at once. Or each permission can be configured respectively. https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#permissions
type Pos ¶
type Pos struct { // Line is a line number of the position. This value is 1-based. Line int // Col is a column number of the position. This value is 1-based. Col int }
Pos represents position in the file.
type Project ¶
type Project struct {
// contains filtered or unexported fields
}
Project represents one GitHub project. One Git repository corresponds to one project.
func (*Project) Config ¶
Config returns config object of the GitHub project repository. The config file is read from ".github/actionlint.yaml" or ".github/actionlint.yml".
func (*Project) Knows ¶
Knows returns true when the project knows the given file. When a file is included in the project's directory, the project knows the file.
func (*Project) WorkflowsDir ¶
WorkflowsDir returns a ".github/workflows" directory path of the GitHub project repository. This method does not check if the directory exists.
type Projects ¶
type Projects struct {
// contains filtered or unexported fields
}
Projects represents set of projects. It caches Project instances which was created previously and reuses them.
type RawYAMLArray ¶
type RawYAMLArray struct { // Elems is list of elements of the array value. Elems []RawYAMLValue // contains filtered or unexported fields }
RawYAMLArray is raw YAML sequence value.
func (*RawYAMLArray) Equals ¶
func (a *RawYAMLArray) Equals(other RawYAMLValue) bool
Equals returns if the other value is equal to the value.
func (*RawYAMLArray) Kind ¶
func (a *RawYAMLArray) Kind() RawYAMLValueKind
Kind returns kind of raw YAML value.
func (*RawYAMLArray) Pos ¶
func (a *RawYAMLArray) Pos() *Pos
Pos returns the start position of the value in the source file
func (*RawYAMLArray) String ¶
func (a *RawYAMLArray) String() string
type RawYAMLObject ¶
type RawYAMLObject struct { // Props is map from property names to their values. Props map[string]RawYAMLValue // contains filtered or unexported fields }
RawYAMLObject is raw YAML mapping value.
func (*RawYAMLObject) Equals ¶
func (o *RawYAMLObject) Equals(other RawYAMLValue) bool
Equals returns if the other value is equal to the value.
func (*RawYAMLObject) Kind ¶
func (o *RawYAMLObject) Kind() RawYAMLValueKind
Kind returns kind of raw YAML value.
func (*RawYAMLObject) Pos ¶
func (o *RawYAMLObject) Pos() *Pos
Pos returns the start position of the value in the source file
func (*RawYAMLObject) String ¶
func (o *RawYAMLObject) String() string
type RawYAMLString ¶
type RawYAMLString struct { // Value is string representation of the scalar node. Value string // contains filtered or unexported fields }
RawYAMLString is raw YAML scalar value.
func (*RawYAMLString) Equals ¶
func (s *RawYAMLString) Equals(other RawYAMLValue) bool
Equals returns if the other value is equal to the value.
func (*RawYAMLString) Kind ¶
func (s *RawYAMLString) Kind() RawYAMLValueKind
Kind returns kind of raw YAML value.
func (*RawYAMLString) Pos ¶
func (s *RawYAMLString) Pos() *Pos
Pos returns the start position of the value in the source file
func (*RawYAMLString) String ¶
func (s *RawYAMLString) String() string
type RawYAMLValue ¶
type RawYAMLValue interface { // Kind returns kind of raw YAML value. Kind() RawYAMLValueKind // Equals returns if the other value is equal to the value. Equals(other RawYAMLValue) bool // Pos returns the start position of the value in the source file Pos() *Pos // String returns string representation of the value String() string }
RawYAMLValue is a value at matrix variation. Any value can be put at matrix variations including mappings and arrays.
type RepositoryDispatchEvent ¶
type RepositoryDispatchEvent struct { // Types is list of types which can trigger workflow. Types []*String // Pos is a position in source. Pos *Pos }
RepositoryDispatchEvent is repository_dispatch event configuration. https://docs.github.com/en/actions/reference/events-that-trigger-workflows#repository_dispatch
func (*RepositoryDispatchEvent) EventName ¶
func (e *RepositoryDispatchEvent) EventName() string
EventName returns name of the event to trigger this workflow.
type RuleAction ¶
type RuleAction struct { RuleBase // contains filtered or unexported fields }
RuleAction is a rule to check running action in steps of jobs. https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepsuses
func NewRuleAction ¶
func NewRuleAction(repoDir string) *RuleAction
NewRuleAction creates new RuleAction instance.
func (*RuleAction) VisitStep ¶
func (rule *RuleAction) VisitStep(n *Step) error
VisitStep is callback when visiting Step node.
type RuleBase ¶
type RuleBase struct {
// contains filtered or unexported fields
}
RuleBase is a struct to be a base of rule structs. Embed this struct to define default methods automatically
func (*RuleBase) EnableDebug ¶ added in v1.2.0
EnableDebug enables debug output from the rule. Given io.Writer instance is used to print debug information to console
func (*RuleBase) VisitJobPost ¶
VisitJobPost is callback when visiting Job node after visiting its children.
func (*RuleBase) VisitJobPre ¶
VisitJobPre is callback when visiting Job node before visiting its children.
func (*RuleBase) VisitWorkflowPost ¶
VisitWorkflowPost is callback when visiting Workflow node after visiting its children.
func (*RuleBase) VisitWorkflowPre ¶
VisitWorkflowPre is callback when visiting Workflow node before visiting its children.
type RuleCredentials ¶
type RuleCredentials struct {
RuleBase
}
RuleCredentials is a rule to check credentials in workflows
func NewRuleCredentials ¶
func NewRuleCredentials() *RuleCredentials
NewRuleCredentials creates new RuleCredentials instance
func (*RuleCredentials) VisitJobPre ¶
func (rule *RuleCredentials) VisitJobPre(n *Job) error
VisitJobPre is callback when visiting Job node before visiting its children.
type RuleEnvVar ¶
type RuleEnvVar struct {
RuleBase
}
RuleEnvVar is a rule checker to check environment variables setup.
func NewRuleEnvVar ¶
func NewRuleEnvVar() *RuleEnvVar
NewRuleEnvVar creates new RuleEnvVar instance.
func (*RuleEnvVar) VisitJobPre ¶
func (rule *RuleEnvVar) VisitJobPre(n *Job) error
VisitJobPre is callback when visiting Job node before visiting its children.
func (*RuleEnvVar) VisitStep ¶
func (rule *RuleEnvVar) VisitStep(n *Step) error
VisitStep is callback when visiting Step node.
func (*RuleEnvVar) VisitWorkflowPre ¶
func (rule *RuleEnvVar) VisitWorkflowPre(n *Workflow) error
VisitWorkflowPre is callback when visiting Workflow node before visiting its children.
type RuleEvents ¶
type RuleEvents struct {
RuleBase
}
RuleEvents is a rule to check 'on' field in workflow. https://docs.github.com/en/actions/reference/events-that-trigger-workflows
func NewRuleEvents ¶
func NewRuleEvents() *RuleEvents
NewRuleEvents creates new RuleEvents instance.
func (*RuleEvents) VisitWorkflowPre ¶
func (rule *RuleEvents) VisitWorkflowPre(n *Workflow) error
VisitWorkflowPre is callback when visiting Workflow node before visiting its children.
type RuleExpression ¶
type RuleExpression struct { RuleBase // contains filtered or unexported fields }
RuleExpression is a rule checker to check expression syntax in string values of workflow syntax. It checks syntax and semantics of the expressions including type checks and functions/contexts definitions. For more details see https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions
func NewRuleExpression ¶
func NewRuleExpression() *RuleExpression
NewRuleExpression creates new RuleExpression instance.
func (*RuleExpression) VisitJobPost ¶
func (rule *RuleExpression) VisitJobPost(n *Job) error
VisitJobPost is callback when visiting Job node after visiting its children
func (*RuleExpression) VisitJobPre ¶
func (rule *RuleExpression) VisitJobPre(n *Job) error
VisitJobPre is callback when visiting Job node before visiting its children.
func (*RuleExpression) VisitStep ¶
func (rule *RuleExpression) VisitStep(n *Step) error
VisitStep is callback when visiting Step node.
func (*RuleExpression) VisitWorkflowPost ¶
func (rule *RuleExpression) VisitWorkflowPost(n *Workflow) error
VisitWorkflowPost is callback when visiting Workflow node after visiting its children
func (*RuleExpression) VisitWorkflowPre ¶
func (rule *RuleExpression) VisitWorkflowPre(n *Workflow) error
VisitWorkflowPre is callback when visiting Workflow node before visiting its children.
type RuleJobNeeds ¶
type RuleJobNeeds struct { RuleBase // contains filtered or unexported fields }
RuleJobNeeds is a rule to check 'needs' field in each job conifiguration. For more details, see https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idneeds
func NewRuleJobNeeds ¶
func NewRuleJobNeeds() *RuleJobNeeds
NewRuleJobNeeds creates new RuleJobNeeds instance.
func (*RuleJobNeeds) VisitJobPre ¶
func (rule *RuleJobNeeds) VisitJobPre(n *Job) error
VisitJobPre is callback when visiting Job node before visiting its children.
func (*RuleJobNeeds) VisitWorkflowPost ¶
func (rule *RuleJobNeeds) VisitWorkflowPost(n *Workflow) error
VisitWorkflowPost is callback when visiting Workflow node after visiting its children.
type RuleMatrix ¶
type RuleMatrix struct {
RuleBase
}
RuleMatrix is a rule checker to check 'matrix' field of job.
func NewRuleMatrix ¶
func NewRuleMatrix() *RuleMatrix
NewRuleMatrix creates new RuleMatrix instance.
func (*RuleMatrix) VisitJobPre ¶
func (rule *RuleMatrix) VisitJobPre(n *Job) error
VisitJobPre is callback when visiting Job node before visiting its children.
type RulePyflakes ¶ added in v1.2.0
type RulePyflakes struct { RuleBase // contains filtered or unexported fields }
RulePyflakes is a rule to check Python scripts at 'run:' using pyflakes. https://github.com/PyCQA/pyflakes
func NewRulePyflakes ¶ added in v1.2.0
func NewRulePyflakes(executable string) (*RulePyflakes, error)
NewRulePyflakes creates new RulePyflakes instance. Parameter executable can be command name or relative/absolute file path. When the given executable is not found in system, it returns an error.
func (*RulePyflakes) VisitJobPost ¶ added in v1.2.0
func (rule *RulePyflakes) VisitJobPost(n *Job) error
VisitJobPost is callback when visiting Job node after visiting its children.
func (*RulePyflakes) VisitJobPre ¶ added in v1.2.0
func (rule *RulePyflakes) VisitJobPre(n *Job) error
VisitJobPre is callback when visiting Job node before visiting its children.
func (*RulePyflakes) VisitStep ¶ added in v1.2.0
func (rule *RulePyflakes) VisitStep(n *Step) error
VisitStep is callback when visiting Step node.
func (*RulePyflakes) VisitWorkflowPost ¶ added in v1.2.0
func (rule *RulePyflakes) VisitWorkflowPost(n *Workflow) error
VisitWorkflowPost is callback when visiting Workflow node after visiting its children.
func (*RulePyflakes) VisitWorkflowPre ¶ added in v1.2.0
func (rule *RulePyflakes) VisitWorkflowPre(n *Workflow) error
VisitWorkflowPre is callback when visiting Workflow node before visiting its children.
type RuleRunnerLabel ¶
type RuleRunnerLabel struct { RuleBase // contains filtered or unexported fields }
RuleRunnerLabel is a rule to check runner label like "ubuntu-latest". There are two types of runners, GitHub-hosted runner and Self-hosted runner. GitHub-hosted runner is described at https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners . And Self-hosted runner is described at https://docs.github.com/en/actions/hosting-your-own-runners/using-self-hosted-runners-in-a-workflow .
func NewRuleRunnerLabel ¶
func NewRuleRunnerLabel(labels []string) *RuleRunnerLabel
NewRuleRunnerLabel creates new RuleRunnerLabel instance.
func (*RuleRunnerLabel) VisitJobPre ¶
func (rule *RuleRunnerLabel) VisitJobPre(n *Job) error
VisitJobPre is callback when visiting Job node before visiting its children.
type RuleShellName ¶
type RuleShellName struct { RuleBase // contains filtered or unexported fields }
RuleShellName is a rule to check 'shell' field. For more details, see https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#using-a-specific-shell
func NewRuleShellName ¶
func NewRuleShellName() *RuleShellName
NewRuleShellName creates new RuleShellName instance.
func (*RuleShellName) VisitJobPost ¶
func (rule *RuleShellName) VisitJobPost(n *Job) error
VisitJobPost is callback when visiting Job node after visiting its children.
func (*RuleShellName) VisitJobPre ¶
func (rule *RuleShellName) VisitJobPre(n *Job) error
VisitJobPre is callback when visiting Job node before visiting its children.
func (*RuleShellName) VisitStep ¶
func (rule *RuleShellName) VisitStep(n *Step) error
VisitStep is callback when visiting Step node.
func (*RuleShellName) VisitWorkflowPre ¶
func (rule *RuleShellName) VisitWorkflowPre(n *Workflow) error
VisitWorkflowPre is callback when visiting Workflow node before visiting its children.
type RuleShellcheck ¶
type RuleShellcheck struct { RuleBase // contains filtered or unexported fields }
RuleShellcheck is a rule to check shell scripts at 'run:' using shellcheck. https://github.com/koalaman/shellcheck
func NewRuleShellcheck ¶
func NewRuleShellcheck(executable string) (*RuleShellcheck, error)
NewRuleShellcheck craetes new RuleShellcheck instance. Parameter executable can be command name or relative/absolute file path. When the given executable is not found in system, it returns an error as 2nd return value.
func (*RuleShellcheck) VisitJobPost ¶
func (rule *RuleShellcheck) VisitJobPost(n *Job) error
VisitJobPost is callback when visiting Job node after visiting its children.
func (*RuleShellcheck) VisitJobPre ¶
func (rule *RuleShellcheck) VisitJobPre(n *Job) error
VisitJobPre is callback when visiting Job node before visiting its children.
func (*RuleShellcheck) VisitStep ¶
func (rule *RuleShellcheck) VisitStep(n *Step) error
VisitStep is callback when visiting Step node.
func (*RuleShellcheck) VisitWorkflowPost ¶
func (rule *RuleShellcheck) VisitWorkflowPost(n *Workflow) error
VisitWorkflowPost is callback when visiting Workflow node after visiting its children.
func (*RuleShellcheck) VisitWorkflowPre ¶
func (rule *RuleShellcheck) VisitWorkflowPre(n *Workflow) error
VisitWorkflowPre is callback when visiting Workflow node before visiting its children.
type RuleStepID ¶
type RuleStepID struct { RuleBase // contains filtered or unexported fields }
RuleStepID is a rule to check step IDs in workflow.
func NewRuleStepID ¶
func NewRuleStepID() *RuleStepID
NewRuleStepID creates a new RuleStepID instance.
func (*RuleStepID) VisitJobPost ¶
func (rule *RuleStepID) VisitJobPost(n *Job) error
VisitJobPost is callback when visiting Job node after visiting its children.
func (*RuleStepID) VisitJobPre ¶
func (rule *RuleStepID) VisitJobPre(n *Job) error
VisitJobPre is callback when visiting Job node before visiting its children.
func (*RuleStepID) VisitStep ¶
func (rule *RuleStepID) VisitStep(n *Step) error
VisitStep is callback when visiting Step node.
type Runner ¶
type Runner struct { // Labels is list label names to select a runner to run a job. There are preset labels and user // defined labels. Runner matching to the labels is selected. Labels []*String }
Runner is struct for runner configuration. https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on
type ScheduledEvent ¶
type ScheduledEvent struct { // Cron is list of cron strings which schedules workflow. Cron []*String // Pos is a position in source. Pos *Pos }
ScheduledEvent is event scheduled by workflow. https://docs.github.com/en/actions/reference/events-that-trigger-workflows#scheduled-events
func (*ScheduledEvent) EventName ¶
func (e *ScheduledEvent) EventName() string
EventName returns name of the event to trigger this workflow.
type Service ¶
type Service struct { // Name is name of the service. Name *String // Container is configuration of container which runs the service. Container *Container }
Service is configuration to run a service like database. https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idservices
type Step ¶
type Step struct { // https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepsid ID *String // https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepsif If *String // https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepsname Name *String Exec Exec // https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepsenv Env *Env // https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepscontinue-on-error ContinueOnError *Bool // https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepstimeout-minutes TimeoutMinutes *Float // Pos is a position in source. Pos *Pos }
Step is step configuration. Step runs one action or one shell script. https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idsteps
type Strategy ¶
type Strategy struct { // Matrix is matrix of combinations of values. Each combination will run the job once. Matrix *Matrix // FailFast is flag to show if other jobs should stop when one job fails. // https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstrategyfail-fast FailFast *Bool // MaxParallel is how many jobs should be run at once. // https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstrategymax-parallel MaxParallel *Int // Pos is a position in source. Pos *Pos }
Strategy is strategy configuration of how the job is run. https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstrategy
type String ¶
type String struct { // Value is a raw value of the string. Value string // Pos is a position of the string in source. Pos *Pos }
String represents generic string value in YAML file with position.
type StringNode ¶
type StringNode struct { // Value is value of the string literal. Escapes are resolved and quotes at both edges are // removed. Value string // contains filtered or unexported fields }
StringNode is node for string literal.
func (*StringNode) Token ¶
func (n *StringNode) Token() *Token
Token returns the first token of the node. This method is useful to get position of this node.
type StringType ¶
type StringType struct{}
StringType is type for string values.
func (StringType) Assignable ¶
func (ty StringType) Assignable(other ExprType) bool
Assignable returns if other type can be assignable to the type.
func (StringType) Equals ¶
func (ty StringType) Equals(other ExprType) bool
Equals returns if the type is equal to the other type.
func (StringType) Fuse ¶
func (ty StringType) Fuse(other ExprType) ExprType
Fuse merges other type into this type. When other type conflicts with this type, fused result is any type as fallback.
func (StringType) String ¶
func (ty StringType) String() string
type Token ¶
type Token struct { // Kind is kind of the token. Kind TokenKind // Value is string representation of the token. Value string // Offset is byte offset of token string starting. Offset int // Line is line number of start position of the token. Note that this value is 1-based. Line int // Column is column number of start position of the token. Note that this value is 1-based. Column int }
Token is a token lexed from expression syntax. For more details, see https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions
type TokenKind ¶
type TokenKind int
TokenKind is kind of token.
const ( // TokenKindUnknown is a default value of token as unknown token value. TokenKindUnknown TokenKind = iota // TokenKindEnd is a token for end of token sequence. Sequence without this // token means invalid. TokenKindEnd // TokenKindIdent is a token for identifier. TokenKindIdent // TokenKindString is a token for string literals. TokenKindString // TokenKindInt is a token for integers including hex integers. TokenKindInt // TokenKindFloat is a token for float numbers. TokenKindFloat // TokenKindLeftParen is a token for '('. TokenKindLeftParen // TokenKindRightParen is a token for ')'. TokenKindRightParen // TokenKindLeftBracket is a token for '['. TokenKindLeftBracket // TokenKindRightBracket is a token for ']'. TokenKindRightBracket // TokenKindDot is a token for '.'. TokenKindDot // TokenKindNot is a token for '!'. TokenKindNot // TokenKindLess is a token for '<'. TokenKindLess // TokenKindLessEq is a token for '<='. TokenKindLessEq // TokenKindGreater is a token for '>'. TokenKindGreater // TokenKindGreaterEq is a token for '>='. TokenKindGreaterEq // TokenKindEq is a token for '=='. TokenKindEq // TokenKindNotEq is a token for '!='. TokenKindNotEq // TokenKindAnd is a token for '&&'. TokenKindAnd // TokenKindOr is a token for '||'. TokenKindOr // TokenKindStar is a token for '*'. TokenKindStar // TokenKindComma is a token for ','. TokenKindComma )
type VariableNode ¶
type VariableNode struct { // Name is name of the variable Name string // contains filtered or unexported fields }
VariableNode is node for variable access.
func (*VariableNode) Token ¶
func (n *VariableNode) Token() *Token
Token returns the first token of the node. This method is useful to get position of this node.
type Visitor ¶
type Visitor struct {
// contains filtered or unexported fields
}
Visitor visits syntax tree from root in depth-first order
func (*Visitor) EnableDebug ¶
EnableDebug enables debug output when non-nil io.Writer value is given. All debug outputs from visitor will be written to the writer.
type WebhookEvent ¶
type WebhookEvent struct { // Hook is a name of the webhook event. Hook *String // Types is list of types of the webhook event. Only the types enumerated here will trigger // the workflow. Types []*String // Branches is list of branch filters to choose branches. Branches []*String // BranchesIgnore is list of branch filters to reject some branches. BranchesIgnore []*String // Tags is list of tag filters to choose tags. Tags []*String // TagsIgnore is list of tag filters to reject some tags. TagsIgnore []*String // Paths is list of path filters to choose file paths. Paths []*String // PathsIgnore is list of path filters to reject some file paths. PathsIgnore []*String // Workflows is list of workflow names which are triggered by 'workflow_run' event. Workflows []*String // Pos is a position in source. Pos *Pos }
WebhookEvent represents event type based on webhook events. Some events can't have 'types' field. Only 'push' and 'pull' events can have 'tags', 'tags-ignore', 'paths' and 'paths-ignore' fields. Only 'workflow_run' event can have 'workflows' field. https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#onevent_nametypes
func (*WebhookEvent) EventName ¶
func (e *WebhookEvent) EventName() string
EventName returns name of the event to trigger this workflow.
type Workflow ¶
type Workflow struct { // Name is name of the workflow. This field can be nil when user didn't specify the name explicitly. // https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#name Name *String // On is list of events which can trigger this workflow. // https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#onpushpull_requestbranchestags On []Event // Permissions is configuration of permissions of this workflow. Permissions *Permissions // Env is a default set of environment variables while running this workflow. // https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#env Env *Env // Defaults is default configuration of how to run scripts. Defaults *Defaults // Concurrency is concurrency configuration of entire workflow. Each jobs also can their own // concurrency configurations. Concurrency *Concurrency // Jobs is mappings from job ID to the job object Jobs map[string]*Job }
Workflow is root of workflow syntax tree, which represents one workflow configuration file. https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
type WorkflowDispatchEvent ¶
type WorkflowDispatchEvent struct { // Inputs is map from input names to input attributes. Inputs map[string]*DispatchInput // Pos is a position in source. Pos *Pos }
WorkflowDispatchEvent is event on dispatching workflow manually. https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_dispatch
func (*WorkflowDispatchEvent) EventName ¶
func (e *WorkflowDispatchEvent) EventName() string
EventName returns name of the event to trigger this workflow.
Source Files ¶
- ast.go
- config.go
- error.go
- expr.go
- expr_ast.go
- expr_lexer.go
- expr_parser.go
- expr_sema.go
- expr_type.go
- linter.go
- parse.go
- pass.go
- project.go
- quotes.go
- rule.go
- rule_action.go
- rule_credentials.go
- rule_env_var.go
- rule_events.go
- rule_expression.go
- rule_job_needs.go
- rule_matrix.go
- rule_pyflakes.go
- rule_runner_label.go
- rule_shell_name.go
- rule_shellcheck.go
- rule_step_id.go