Sets up actions/cache for the yarn cache directory (default: ~/.cache/yarn).
- Caches yarn's global cache to speed up installs in subsequent runs.
- Exports
YARN_CACHE_FOLDER(andyarn_cache_folder) viaGITHUB_ENVso yarn uses the same cache path in later steps. - No-op when no
yarn.lockis found. - Uses lockfile hash in the cache key for correctness.
Run after checkout; run before any yarn install command.
- name: ⬇️ Checkout
uses: actions/checkout@v4
- name: 📦 Cache yarn
uses: w5s/actions/cache-yarn@main
with:
cache-path: .yarn-cache # optionalcache-path(optional): yarn cache directory to store/restore. Defaults to~/.cache/yarn.nm-mode(optional): Yarn nm mode. Default is"hardlinks-local".
- Use in projects that have
yarn.lock(yarn). Node/yarn must be available (e.g. afterci-setup).