Documentation
¶
Overview ¶
Package actionref resolves an action that a step's `uses` names outside Probe to the executable that serves it.
Such an action is published in a GitHub repository and pinned to a commit:
uses: github.com/<owner>/<repo>[/<dir>]@<40-character commit SHA>
or lives in a local directory:
uses: ./path/to/action
Either way the directory holds an action.yml that says which executable serves the action. The executable speaks the protocol in package actionrpc.
Index ¶
Constants ¶
const ManifestFile = "action.yml"
ManifestFile is the file in an action's directory that describes it.
const UsingBinary = "binary"
UsingBinary is the only kind of action an action.yml can describe: an executable that serves the action over the actionrpc protocol.
Variables ¶
This section is empty.
Functions ¶
func IsExternal ¶
IsExternal reports whether uses names an action outside Probe. No built-in action has a slash in its name.
Types ¶
type Executable ¶
type Executable struct {
// Path is the executable's location on this machine.
Path string
// SHA256 is the digest the executable must have when it is started, or
// empty for a local action that does not pin one.
SHA256 []byte
}
Executable is the program that serves an action.
func Resolve ¶
func Resolve(uses, baseDir string) (*Executable, error)
Resolve resolves uses with a Resolver shared by the whole process.
type Manifest ¶
type Manifest struct {
Name string `yaml:"name"`
Description string `yaml:"description"`
Runs Runs `yaml:"runs"`
// Guard are the kinds of guard the action keeps to itself, such as
// read-only and allow-host. Probe takes the action at its word and runs
// it under a guard of those kinds; a kind Probe does not know is left
// alone, so the action is refused under a guard it does not name.
Guard []string `yaml:"guard"`
// Params are the keys the action takes in with, for probe check to
// check a step's with against. Nil, when action.yml does not say, takes
// any key.
Params []string `yaml:"params"`
}
Manifest is the content of an action.yml.
func ParseManifest ¶
ParseManifest parses the content of an action.yml.
func ReadManifest ¶ added in v1.21.0
ReadManifest reads the action.yml of uses with the Resolver shared by the whole process, which Resolve then uses for the same action.
type Ref ¶
type Ref struct {
// Local is the directory of a local action, as written. The other fields
// are empty when it is set.
Local string
// Owner and Repo name the GitHub repository of a remote action.
Owner string
Repo string
// Dir is the directory of the action within the repository, slash
// separated, or empty for the repository root.
Dir string
// SHA is the commit the action is pinned to.
SHA string
}
Ref is a parsed `uses` that names an external action.
type Resolver ¶
type Resolver struct {
// CacheDir is where downloaded actions are kept. It defaults to probe/actions
// under the user's cache directory.
CacheDir string
// Client fetches action.yml files and executables. It defaults to a client
// with a five-minute timeout.
Client *http.Client
// RawBaseURL is where file contents of a GitHub repository are served. It
// defaults to https://raw.githubusercontent.com.
RawBaseURL string
// OS and Arch are the platform to resolve for. They default to the
// platform Probe runs on.
OS string
Arch string
// contains filtered or unexported fields
}
Resolver finds and downloads the executables of external actions. A Resolver remembers what it resolved, so an action is fetched once however many steps use it. Its zero value is ready to use.
type Runs ¶
type Runs struct {
// Using is the kind of action. It must be "binary".
Using string `yaml:"using"`
// URL is where the executable is downloaded from. {os} and {arch} are
// replaced with the GOOS and GOARCH of the machine running Probe.
URL string `yaml:"url"`
// Path is the executable relative to the action's directory, with the
// same placeholders as URL. Only a local action can use it.
Path string `yaml:"path"`
// Checksums maps "<os>_<arch>" to the SHA-256 digest of the executable
// for that platform, in hex. A URL needs one for the running platform.
Checksums map[string]string `yaml:"checksums"`
}
Runs says how an action is run.