Documentation
¶
Overview ¶
Package ghactions provides functions to replace tags for checksums in GitHub Actions workflows.
Index ¶
- Variables
- func GetChecksum(ctx context.Context, ghcli *github.Client, action, ref string) (string, error)
- func IsLocal(input string) bool
- func ModifyReferencesInYAML(ctx context.Context, ghcli *github.Client, node *yaml.Node, ...) (bool, error)
- func ParseActionReference(input string) (action string, reference string, err error)
- func TraverseGitHubActionWorkflows(bfs billy.Filesystem, base string, fun TraverseFunc) error
- type Action
- type TraverseFunc
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, ghcli *github.Client, 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 ParseActionReference ¶
ParseActionReference parses an action reference into action and reference.
func TraverseGitHubActionWorkflows ¶
func TraverseGitHubActionWorkflows(bfs billy.Filesystem, base string, fun TraverseFunc) 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.