Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
play

GitHub Action

Yarn install cache

v1

Yarn install cache

play

Yarn install cache

1-liner yarn install cache for GitHub Actions

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Yarn install cache

uses: c-hive/gha-yarn-cache@v1

Learn more about this action in c-hive/gha-yarn-cache

Choose a version

gha-yarn-cache

1-liner yarn install cache for GitHub Actions

Status and support

  • ✔ stable
  • ✔ supported
  • ✔ ongoing development

CI

GitHub Action caches improve build times and reduce network dependencies. However, writing the correct cache logic is tricky. You need to understand how the cache action (keys and restore keys) work. Did you know you're not supposed to cache the node_modules folder? The setup is different per OS and takes a lot of space in your workflows. Not anymore!

gha-yarn-cache is a simple 1-liner that covers all use-cases, correctly:

Usage

Add this step before yarn install:

uses: c-hive/gha-yarn-cache@v1

For example:

.github/workflows/ci.yml

name: CI

on: [push]

jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1

    - uses: c-hive/gha-yarn-cache@v1

    - name: Install JS dependencies
      run: yarn install
    - name: Test
      run: yarn test

Conventions

This project follows C-Hive guides for code style, way of working and other development concerns.

License

The project is available as open source under the terms of the MIT License.