Documentation ¶
Overview ¶
Package ghactions provides functions to locate action references and replace tags for checksums in GitHub Actions workflows.
Index ¶
- Variables
- func GetChecksum(ctx context.Context, restIf interfaces.REST, action, ref string) (string, error)
- func IsLocal(input string) bool
- func ModifyReferencesInYAML(ctx context.Context, restIf interfaces.REST, node *yaml.Node, ...) (bool, error)
- func ModifyReferencesInYAMLWithCache(ctx context.Context, restIf interfaces.REST, node *yaml.Node, ...) (bool, error)
- func ParseActionReference(input string) (action string, reference string, err error)
- func TraverseGitHubActionWorkflows(bfs billy.Filesystem, base string, fun TraverseGHWFunc) error
- type Action
- type TraverseGHWFunc
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidAction is returned when parsing the action fails. ErrInvalidAction = fmt.Errorf("invalid action") )
Functions ¶
func GetChecksum ¶
GetChecksum returns the checksum for a given action and tag.
func ModifyReferencesInYAML ¶
func ModifyReferencesInYAML(ctx context.Context, restIf interfaces.REST, node *yaml.Node, cfg *config.GHActions) (bool, error)
ModifyReferencesInYAML takes the given YAML structure and replaces all references to tags with the checksum of the tag. Note that the given YAML structure is modified in-place. The function returns true if any references were modified.
func ModifyReferencesInYAMLWithCache ¶ added in v0.0.7
func ModifyReferencesInYAMLWithCache( ctx context.Context, restIf interfaces.REST, node *yaml.Node, cfg *config.GHActions, cache utils.RefCacher) (bool, error)
ModifyReferencesInYAMLWithCache takes the given YAML structure and replaces all references to tags with the checksum of the tag. Note that the given YAML structure is modified in-place. The function returns true if any references were modified. The function uses the provided cache to store the checksums.
func ParseActionReference ¶
ParseActionReference parses an action reference into action and reference.
func TraverseGitHubActionWorkflows ¶
func TraverseGitHubActionWorkflows(bfs billy.Filesystem, base string, fun TraverseGHWFunc) error
TraverseGitHubActionWorkflows traverses the GitHub Actions workflows in the given directory and calls the given function with each workflow.
Types ¶
type Action ¶ added in v0.0.2
type Action struct { Action string `json:"action"` Owner string `json:"owner"` Repo string `json:"repo"` Ref string `json:"ref"` }
Action represents an action reference.
func ListActionsInDirectory ¶ added in v0.0.3
ListActionsInDirectory returns a list of actions referenced in the given directory.
func ListActionsInYAML ¶ added in v0.0.2
ListActionsInYAML returns a list of actions referenced in the given YAML structure.
type TraverseGHWFunc ¶ added in v0.0.5
TraverseGHWFunc is a function that gets called with each file in a GitHub Actions workflow directory. It receives the path to the file and the parsed workflow.