toolcache

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CacheDir

func CacheDir(source, tool, version, arch string) (string, error)

CacheDir caches a tool dir into the GitHub Actions runner tool cache. If addPath is true, the tool will be added to the PATH.

func CacheFile

func CacheFile(source, targetName, tool, version, arch string) (string, error)

CacheFile caches a tool file into the GitHub Actions runner tool cache. If addPath is true, the tool will be added to the PATH.

func CheckVersion

func CheckVersion(version, versionSpec string) (bool, error)

CheckVersion checks if a version meets a version specification.

func DownloadTool

func DownloadTool(ctx context.Context, logger any, url url.URL) (string, error)

DownloadTool downloads a tool from a URL and saves it to a temporary directory.

func ExtractTar

func ExtractTar(tarFile string, gz bool) (string, error)

ExtractTar extracts a tarball into a temporary directory. If gz is true, it will decompress the file.

func ExtractZip

func ExtractZip(zipFile string) (string, error)

ExtractZip extracts a zip archive into a temporary directory.

func FindAllToolVersions

func FindAllToolVersions(tool, arch string) ([]string, error)

FindAllToolVersions returns all versions of a tool in the GitHub Actions runner tool cache.

func FindTool

func FindTool(tool, arch, versionSpec string) (string, error)

FindTool finds a tool in the GitHub Actions runner tool cache that matches the version constraint. If the versionSpec isn't an explicit version then it will be evaluated as a semver constraint. Will return the path to the tool or an empty string if no tool is found.

func GetToolCacheDirectory

func GetToolCacheDirectory() (string, error)

GetToolCacheDirectory returns the path to the GitHub Actions runner tool cache directory.

func ResolveToolDirectory added in v0.0.7

func ResolveToolDirectory(extractedPath string) (string, error)

ResolveToolDirectory navigates nested directories to find the actual tool location. It handles:

  • Single nested directories
  • 'bin' subdirectory after evaluating single nested directories

For example, if an archive extracts to:

extracted/
├── jsonschema-v1.0.0/
│   ├── bin/
│   │   └── jsonschema
│   └── lib/

This will resolve to: extracted/jsonschema-v1.0.0/bin.

Types

This section is empty.

Jump to

Keyboard shortcuts

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