Functions necessary for caching dependencies and build outputs to improve workflow execution time.
This module exposes bindings to the @actions/cache package. See the @actions/cache README for more details and important cache limit information.
This package is used by the v2+ versions of our first party cache action. You can find an example implementation in the cache repo here.
Restores a cache based on key
and restoreKeys
to the paths
provided. Function returns the cache key for cache hit and returns undefined if cache not found.
let paths =
[ "node_modules"
, "packages/*/node_modules"
]
let primaryKey = 'npm-foobar-d5ea0750'
let restoreKeys =
[ "npm-foobar-"
, "npm-"
]
Cache.restoreCache { paths, primaryKey, restoreKeys: Just restoreKeys, options: Nothing }
Saves a cache containing the files in paths
using the key
provided. The files would be compressed using zstandard compression algorithm if zstd is installed, otherwise gzip is used. Function returns the cache id if the cache was saved succesfully and throws an error if cache upload fails.
let paths =
[ "node_modules"
, "packages/*/node_modules/"
]
let key = 'npm-foobar-d5ea0750'
cacheId <- Cache.saveCache { paths, key }