ghactions

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package ghactions provides functions to replace tags for checksums in GitHub Actions workflows.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidAction is returned when parsing the action fails.
	ErrInvalidAction = fmt.Errorf("invalid action")
)

Functions

func GetChecksum

func GetChecksum(ctx context.Context, ghcli *github.Client, action, ref string) (string, error)

GetChecksum returns the checksum for a given action and tag.

func IsLocal

func IsLocal(input string) bool

IsLocal returns true if the input is a local path.

func ModifyReferencesInYAML

func ModifyReferencesInYAML(ctx context.Context, ghcli *github.Client, node *yaml.Node) (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

func ParseActionReference(input string) (action string, reference string, err error)

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 TraverseFunc

type TraverseFunc func(path string, wflow *yaml.Node) error

TraverseFunc 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL