Skip to content

Latest commit

 

History

History
39 lines (29 loc) · 1.48 KB

File metadata and controls

39 lines (29 loc) · 1.48 KB

GitHub.Actions.Cache

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.

Usage

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.

Restore Cache

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 }

Save Cache

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 }