Skip to content

Commit

Permalink
fix GitHub document URLs by fixred part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysd committed Sep 28, 2021
1 parent 0b73752 commit a3f270b
Show file tree
Hide file tree
Showing 28 changed files with 149 additions and 149 deletions.
122 changes: 61 additions & 61 deletions ast.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion expr.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package actionlint
import "fmt"

// 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
// https://docs.github.com/en/actions/learn-github-actions/contexts
type ExprError struct {
// Message is an error message
Message string
Expand Down
2 changes: 1 addition & 1 deletion expr_ast.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package actionlint

// 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
// https://docs.github.com/en/actions/learn-github-actions/contexts
type ExprNode interface {
// Token returns the first token of the node. This method is useful to get position of this node.
Token() *Token
Expand Down
4 changes: 2 additions & 2 deletions expr_insecure.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func (m UntrustedInputMap) findElemChild() (UntrustedInputMap, bool) {
// BuiltinUntrustedInputs is list of untrusted inputs. These inputs are detected as untrusted in
// `run:` scripts. See the URL for more details.
// - https://securitylab.github.com/research/github-actions-untrusted-input/
// - https://docs.github.com/en/actions/learn-github-actions/security-hardening-for-github-actions
// - https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions
// - https://github.com/github/codeql/blob/main/javascript/ql/src/experimental/Security/CWE-094/ExpressionInjection.ql
var BuiltinUntrustedInputs = UntrustedInputMap{
"github": {
Expand Down Expand Up @@ -186,7 +186,7 @@ func (u *UntrustedInputChecker) error(n ExprNode) {
var b strings.Builder
b.WriteByte('"')
v := buildPathOfObjectDereference(&b, n)
b.WriteString(`" is potentially untrusted. avoid using it directly in inline scripts. instead, pass it through an environment variable. see https://docs.github.com/en/actions/learn-github-actions/security-hardening-for-github-actions for more details`)
b.WriteString(`" is potentially untrusted. avoid using it directly in inline scripts. instead, pass it through an environment variable. see https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions for more details`)
err := errorAtExpr(v, b.String())
u.errs = append(u.errs, err)
u.done()
Expand Down
8 changes: 4 additions & 4 deletions expr_lexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func (t TokenKind) String() string {
}

// 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
// https://docs.github.com/en/actions/learn-github-actions/contexts
type Token struct {
// Kind is kind of the token.
Kind TokenKind
Expand Down Expand Up @@ -154,7 +154,7 @@ const expectedAlphaChars = "'a'..'z', 'A'..'Z', '_'"
const expectedAllChars = expectedAlphaChars + ", " + expectedDigitChars + ", " + expectedPunctChars

// 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
// https://docs.github.com/en/actions/learn-github-actions/contexts
type ExprLexer struct {
src string
scan scanner.Scanner
Expand Down Expand Up @@ -263,7 +263,7 @@ func (lex *ExprLexer) unexpectedEOF() *Token {
func (lex *ExprLexer) lexIdent() *Token {
for {
// a-z, A-Z, 0-9, - or _
// https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#contexts
// https://docs.github.com/en/actions/learn-github-actions/contexts#contexts
if r := lex.eat(); !isAlnum(r) && r != '_' && r != '-' {
return lex.token(TokenKindIdent)
}
Expand Down Expand Up @@ -469,7 +469,7 @@ func (lex *ExprLexer) Next() *Token {
}

// Ident starts with a-z or A-Z or _
// https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#contexts
// https://docs.github.com/en/actions/learn-github-actions/contexts#contexts
if isAlpha(r) || r == '_' {
return lex.lexIdent()
}
Expand Down
2 changes: 1 addition & 1 deletion expr_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func errorAtToken(t *Token, msg string) *ExprError {
}

// 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
// https://docs.github.com/en/actions/learn-github-actions/contexts
type ExprParser struct {
cur *Token
lexer *ExprLexer
Expand Down
26 changes: 13 additions & 13 deletions expr_sema.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (sig *FuncSignature) String() string {

// 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
// https://docs.github.com/en/actions/learn-github-actions/contexts#functions
var BuiltinFuncSignatures = map[string][]*FuncSignature{
"contains": {
{
Expand Down Expand Up @@ -190,9 +190,9 @@ var BuiltinFuncSignatures = map[string][]*FuncSignature{
// Global variables

// 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
// documented at https://docs.github.com/en/actions/learn-github-actions/contexts#contexts
var BuiltinGlobalVariableTypes = map[string]ExprType{
// https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#github-context
// https://docs.github.com/en/actions/learn-github-actions/contexts#github-context
"github": NewStrictObjectType(map[string]ExprType{
"action": StringType{},
"action_path": StringType{},
Expand Down Expand Up @@ -223,9 +223,9 @@ var BuiltinGlobalVariableTypes = map[string]ExprType{
"retention_days": NumberType{},
"server_url": StringType{},
}),
// https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#env-context
// https://docs.github.com/en/actions/learn-github-actions/contexts#env-context
"env": NewMapObjectType(StringType{}), // env.<env_name>
// https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#job-context
// https://docs.github.com/en/actions/learn-github-actions/contexts#job-context
"job": NewStrictObjectType(map[string]ExprType{
"container": NewStrictObjectType(map[string]ExprType{
"id": StringType{},
Expand All @@ -240,28 +240,28 @@ var BuiltinGlobalVariableTypes = map[string]ExprType{
),
"status": StringType{},
}),
// https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#steps-context
// https://docs.github.com/en/actions/learn-github-actions/contexts#steps-context
"steps": NewEmptyStrictObjectType(), // This value will be updated contextually
// https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#runner-context
// https://docs.github.com/en/actions/learn-github-actions/contexts#runner-context
"runner": NewStrictObjectType(map[string]ExprType{
"os": StringType{},
"temp": StringType{},
"tool_cache": StringType{},
// These are not documented but actually exist
"workspace": StringType{},
}),
// https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#contexts
// https://docs.github.com/en/actions/learn-github-actions/contexts#contexts
"secrets": NewEmptyObjectType(),
// https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#contexts
// https://docs.github.com/en/actions/learn-github-actions/contexts#contexts
"strategy": NewObjectType(map[string]ExprType{
"fail-fast": BoolType{},
"job-index": NumberType{},
"job-total": NumberType{},
"max-parallel": NumberType{},
}),
// https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#contexts
// https://docs.github.com/en/actions/learn-github-actions/contexts#contexts
"matrix": NewEmptyStrictObjectType(), // This value will be updated contextually
// https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#needs-context
// https://docs.github.com/en/actions/learn-github-actions/contexts#needs-context
"needs": NewEmptyStrictObjectType(), // This value will be updated contextually
}

Expand All @@ -270,7 +270,7 @@ var BuiltinGlobalVariableTypes = map[string]ExprType{
// 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
// https://docs.github.com/en/actions/learn-github-actions/contexts#contexts
type ExprSemanticsChecker struct {
funcs map[string][]*FuncSignature
vars map[string]ExprType
Expand Down Expand Up @@ -609,7 +609,7 @@ func (sema *ExprSemanticsChecker) checkCompareOp(n *CompareOpNode) ExprType {
sema.check(n.Right)
// Note: Comparing values is very loose. Any value can be compared with any value without an
// error.
// https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#operators
// https://docs.github.com/en/actions/learn-github-actions/contexts#operators
return BoolType{}
}

Expand Down
4 changes: 2 additions & 2 deletions glob.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,14 @@ func validateGlob(pat string, isRef bool) []InvalidGlobPattern {

// ValidateRefGlob checks a given input as glob pattern for Git ref names. It returns list of
// errors found by the validation. See the following URL for more details of the sytnax:
// https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet
// https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet
func ValidateRefGlob(pat string) []InvalidGlobPattern {
return validateGlob(pat, true)
}

// ValidatePathGlob checks a given input as glob pattern for file paths. It returns list of
// errors found by the validation. See the following URL for more details of the sytnax:
// https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet
// https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet
func ValidatePathGlob(pat string) []InvalidGlobPattern {
return validateGlob(pat, false)
}
40 changes: 20 additions & 20 deletions parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ func (p *parser) parseScheduleEvent(pos *Pos, n *yaml.Node) *ScheduledEvent {
return &ScheduledEvent{cron, pos}
}

// https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_dispatch
// https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#workflow_dispatch
func (p *parser) parseWorkflowDispatchEvent(pos *Pos, n *yaml.Node) *WorkflowDispatchEvent {
ret := &WorkflowDispatchEvent{Pos: pos}

Expand Down Expand Up @@ -340,7 +340,7 @@ func (p *parser) parseWorkflowDispatchEvent(pos *Pos, n *yaml.Node) *WorkflowDis
return ret
}

// https://docs.github.com/en/actions/reference/events-that-trigger-workflows#repository_dispatch
// https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#repository_dispatch
func (p *parser) parseRepositoryDispatchEvent(pos *Pos, n *yaml.Node) *RepositoryDispatchEvent {
ret := &RepositoryDispatchEvent{Pos: pos}

Expand Down Expand Up @@ -472,7 +472,7 @@ func (p *parser) parseEvents(pos *Pos, n *yaml.Node) []Event {
}
}

// https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#permissions
// https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#permissions
func (p *parser) parsePermissions(pos *Pos, n *yaml.Node) *Permissions {
ret := &Permissions{Pos: pos}

Expand All @@ -493,7 +493,7 @@ func (p *parser) parsePermissions(pos *Pos, n *yaml.Node) *Permissions {
return ret
}

// https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#env
// https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#env
func (p *parser) parseEnv(n *yaml.Node) *Env {
if n.Kind == yaml.ScalarNode {
return &Env{
Expand All @@ -514,7 +514,7 @@ func (p *parser) parseEnv(n *yaml.Node) *Env {
return &Env{Vars: vars}
}

// https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#defaults
// https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#defaults
func (p *parser) parseDefaults(pos *Pos, n *yaml.Node) *Defaults {
ret := &Defaults{Pos: pos}

Expand Down Expand Up @@ -544,7 +544,7 @@ func (p *parser) parseDefaults(pos *Pos, n *yaml.Node) *Defaults {
return ret
}

// https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idconcurrency
// https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_idconcurrency
func (p *parser) parseConcurrency(pos *Pos, n *yaml.Node) *Concurrency {
ret := &Concurrency{Pos: pos}

Expand All @@ -571,7 +571,7 @@ func (p *parser) parseConcurrency(pos *Pos, n *yaml.Node) *Concurrency {
return ret
}

// https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idenvironment
// https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_idenvironment
func (p *parser) parseEnvironment(pos *Pos, n *yaml.Node) *Environment {
ret := &Environment{Pos: pos}

Expand All @@ -598,7 +598,7 @@ func (p *parser) parseEnvironment(pos *Pos, n *yaml.Node) *Environment {
return ret
}

// https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idoutputs
// https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_idoutputs
func (p *parser) parseOutputs(n *yaml.Node) map[string]*Output {
outputs := p.parseSectionMapping("outputs", n, false)
ret := make(map[string]*Output, len(outputs))
Expand Down Expand Up @@ -639,8 +639,8 @@ func (p *parser) parseRawYAMLValue(n *yaml.Node) RawYAMLValue {
}
}

// https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#example-including-additional-values-into-combinations
// https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#example-excluding-configurations-from-a-matrix
// https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#example-including-additional-values-into-combinations
// https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#example-excluding-configurations-from-a-matrix
func (p *parser) parseMatrixCombinations(sec string, n *yaml.Node) *MatrixCombinations {
if n.Kind == yaml.ScalarNode {
return &MatrixCombinations{
Expand Down Expand Up @@ -673,7 +673,7 @@ func (p *parser) parseMatrixCombinations(sec string, n *yaml.Node) *MatrixCombin
return &MatrixCombinations{Combinations: ret}
}

// https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix
// https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix
func (p *parser) parseMatrix(pos *Pos, n *yaml.Node) *Matrix {
if n.Kind == yaml.ScalarNode {
return &Matrix{
Expand Down Expand Up @@ -719,7 +719,7 @@ func (p *parser) parseMatrix(pos *Pos, n *yaml.Node) *Matrix {
return ret
}

// https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstrategy
// https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_idstrategy
func (p *parser) parseStrategy(pos *Pos, n *yaml.Node) *Strategy {
ret := &Strategy{Pos: pos}

Expand All @@ -739,7 +739,7 @@ func (p *parser) parseStrategy(pos *Pos, n *yaml.Node) *Strategy {
return ret
}

// https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idcontainer
// https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_idcontainer
func (p *parser) parseContainer(sec string, pos *Pos, n *yaml.Node) *Container {
ret := &Container{Pos: pos}

Expand Down Expand Up @@ -792,7 +792,7 @@ func (p *parser) parseContainer(sec string, pos *Pos, n *yaml.Node) *Container {
return ret
}

// https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idsteps
// https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_idsteps
func (p *parser) parseStep(n *yaml.Node) *Step {
ret := &Step{Pos: posAt(n)}
var workDir *String
Expand Down Expand Up @@ -830,10 +830,10 @@ func (p *parser) parseStep(n *yaml.Node) *Step {
for _, input := range with {
switch input.key.Value {
case "entrypoint":
// https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepswithentrypoint
// https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_idstepswithentrypoint
exec.Entrypoint = p.parseString(input.val, false)
case "args":
// https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepswithargs
// https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_idstepswithargs
exec.Args = p.parseString(input.val, true)
default:
exec.Inputs[input.key.Value] = &Input{input.key, p.parseString(input.val, true)}
Expand Down Expand Up @@ -899,7 +899,7 @@ func (p *parser) parseStep(n *yaml.Node) *Step {
return ret
}

// https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idsteps
// https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_idsteps
func (p *parser) parseSteps(n *yaml.Node) []*Step {
if ok := p.checkSequence("steps", n, false); !ok {
return nil
Expand All @@ -916,7 +916,7 @@ func (p *parser) parseSteps(n *yaml.Node) []*Step {
return ret
}

// https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_id
// https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_id
func (p *parser) parseJob(id *String, n *yaml.Node) *Job {
ret := &Job{ID: id, Pos: id.Pos}

Expand Down Expand Up @@ -1002,7 +1002,7 @@ func (p *parser) parseJob(id *String, n *yaml.Node) *Job {
return ret
}

// https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobs
// https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#jobs
func (p *parser) parseJobs(n *yaml.Node) map[string]*Job {
jobs := p.parseSectionMapping("jobs", n, false)
ret := make(map[string]*Job, len(jobs))
Expand All @@ -1013,7 +1013,7 @@ func (p *parser) parseJobs(n *yaml.Node) map[string]*Job {
return ret
}

// https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
// https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions
func (p *parser) parse(n *yaml.Node) *Workflow {
w := &Workflow{}

Expand Down
Loading

0 comments on commit a3f270b

Please sign in to comment.