Documentation ¶
Index ¶
- func CheckFileContainsCommands(content []byte, comment string) bool
- func FormatActionlintError(errs []*actionlint.Error) error
- func GetJobName(job *actionlint.Job) string
- func GetLineNumber(pos *actionlint.Pos) uint
- func GetOSesForJob(job *actionlint.Job) ([]string, error)
- func GetShellForStep(step *actionlint.Step, job *actionlint.Job) (string, error)
- func GetStepName(step *actionlint.Step) string
- func GetUses(step *actionlint.Step) *actionlint.String
- func IsGitHubOwnedAction(actionName string) bool
- func IsGithubWorkflowFileCb(pathfn string) (bool, error)
- func IsGitlabWorkflowFile(pathfn string) (bool, error)
- func IsStepExecKind(step *actionlint.Step, kind actionlint.ExecKind) bool
- func IsStepWindows(step *actionlint.Step) (bool, error)
- func IsTemplateFile(pathfn string) bool
- func IsWorkflowFile(pathfn string) bool
- func JobAlwaysRunsOnWindows(job *actionlint.Job) (bool, error)
- func OnAllFilesDo(repoClient clients.RepoClient, onFile DoWhileTrueOnFilename, ...) error
- func OnMatchingFileContentDo(repoClient clients.RepoClient, matchPathTo PathMatcher, ...) error
- type DoWhileTrueOnFileContent
- type DoWhileTrueOnFilename
- type JobMatchResult
- type JobMatcher
- type JobMatcherStep
- type PathMatcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckFileContainsCommands ¶
CheckFileContainsCommands checks if the file content contains commands or not. `comment` is the string or character that indicates a comment: for example for Dockerfiles, it would be `#`.
func FormatActionlintError ¶
func FormatActionlintError(errs []*actionlint.Error) error
FormatActionlintError combines the errors into a single one.
func GetJobName ¶
func GetJobName(job *actionlint.Job) string
GetJobName returns Name.Value if non-nil, else returns "".
func GetLineNumber ¶
func GetLineNumber(pos *actionlint.Pos) uint
GetLineNumber returns the line number for this position.
func GetOSesForJob ¶
func GetOSesForJob(job *actionlint.Job) ([]string, error)
GetOSesForJob returns the OSes this job runs on.
func GetShellForStep ¶
func GetShellForStep(step *actionlint.Step, job *actionlint.Job) (string, error)
GetShellForStep returns the shell that is used to run the given step.
func GetStepName ¶
func GetStepName(step *actionlint.Step) string
GetStepName returns Name.Value if non-nil, else returns "".
func GetUses ¶
func GetUses(step *actionlint.Step) *actionlint.String
GetUses returns the 'uses' statement in this step or nil if this step does not have one.
func IsGitHubOwnedAction ¶
IsGitHubOwnedAction checks if this is a github specific action.
func IsGithubWorkflowFileCb ¶ added in v4.1.0
IsGithubWorkflowFileCb determines if a file is a workflow as a callback to use for repo client's ListFiles() API.
func IsGitlabWorkflowFile ¶ added in v4.11.0
IsGitlabWorkflowFile determines if a file is a workflow as a callback to use for repo client's ListFiles() API.
func IsStepExecKind ¶
func IsStepExecKind(step *actionlint.Step, kind actionlint.ExecKind) bool
IsStepExecKind compares input `step` ExecKind with `kind` and returns true on a match.
func IsStepWindows ¶
func IsStepWindows(step *actionlint.Step) (bool, error)
IsStepWindows returns true if the step will be run on Windows.
func IsTemplateFile ¶
IsTemplateFile returns true if the file name contains a string commonly used in template files.
func IsWorkflowFile ¶
IsWorkflowFile returns true if this is a GitHub workflow file.
func JobAlwaysRunsOnWindows ¶
func JobAlwaysRunsOnWindows(job *actionlint.Job) (bool, error)
JobAlwaysRunsOnWindows returns true if the only OS that this job runs on is Windows.
func OnAllFilesDo ¶ added in v4.2.0
func OnAllFilesDo(repoClient clients.RepoClient, onFile DoWhileTrueOnFilename, args ...interface{}) error
OnAllFilesDo iterates through all files returned by `repoClient` and calls `onFile` fn on them until `onFile` returns error or a false value.
func OnMatchingFileContentDo ¶ added in v4.2.0
func OnMatchingFileContentDo(repoClient clients.RepoClient, matchPathTo PathMatcher, onFileContent DoWhileTrueOnFileContent, args ...interface{}, ) error
OnMatchingFileContentDo matches all files listed by `repoClient` against `matchPathTo` and on every successful match, runs onFileContent fn on the file's contents. Continues iterating along the matched files until onFileContent returns either a false value or an error.
Types ¶
type DoWhileTrueOnFileContent ¶ added in v4.2.0
DoWhileTrueOnFileContent takes a filepath, its content and optional variadic args. It returns a boolean indicating whether iterating over next files should continue.
type DoWhileTrueOnFilename ¶ added in v4.2.0
DoWhileTrueOnFilename takes a filename and optional variadic args and returns true if the next filename should continue to be processed.
type JobMatchResult ¶ added in v4.4.0
JobMatchResult represents the result of a matche.
func AnyJobsMatch ¶ added in v4.2.0
func AnyJobsMatch(workflow *actionlint.Workflow, jobMatchers []JobMatcher, fp string, logMsgNoMatch string, ) (JobMatchResult, bool)
AnyJobsMatch returns true if any of the jobs have a match in the given workflow.
func IsPackagingWorkflow ¶ added in v4.5.0
func IsPackagingWorkflow(workflow *actionlint.Workflow, fp string) (JobMatchResult, bool)
IsPackagingWorkflow checks for a packaging workflow.
type JobMatcher ¶
type JobMatcher struct { // The text to be logged when a job match is found. LogText string // Each step in this field has a matching step in the job. Steps []*JobMatcherStep }
JobMatcher is rule for matching a job.
type JobMatcherStep ¶
type JobMatcherStep struct { // If set, the step's 'Uses' must match this field. Checks that the action name is the same. Uses string // If set, the step's 'With' have the keys and values that are in this field. With map[string]string // If set, the step's 'Run' must match this field. Does a regex match using this field. Run string }
JobMatcherStep is a single step that needs to be matched.
type PathMatcher ¶ added in v4.2.0
PathMatcher represents a query for a filepath.