Skip to content

Commit

Permalink
Change yarn caching in GitHub Actions to allow partial caching
Browse files Browse the repository at this point in the history
Previously it was all or nothing, so a single change will
have to re-download everything.
Now it works the same as local, only downloading the one new package.
  • Loading branch information
CarsonF authored and adam-soltech committed Oct 31, 2023
1 parent ec0b904 commit 1bc67d5
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
22 changes: 22 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Node Setup & Yarn Install
description: 'Setup Node.js and install dependencies with Yarn'
runs:
using: composite
steps:
- uses: actions/setup-node@v3
with:
node-version: 20

- name: Yarn cache
uses: actions/cache@v3
with:
path: .yarn/cache
key: yarn-cache-${{ hashFiles('yarn.lock', '.yarnrc.yml') }}
restore-keys: yarn-cache-

- name: Install dependencies
shell: bash
run: yarn install
env:
# Use the local cache folder, so we can cache it above
YARN_ENABLE_GLOBAL_CACHE: 'false'
11 changes: 5 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@ jobs:

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
cache: yarn

- name: Install dependencies
run: yarn install && yarn dedupe --check
- name: Node Setup & Yarn Install
uses: ./.github/actions/setup

- name: Check for no duplicate dependencies
run: yarn dedupe --check

- name: Match API PR
uses: actions-ecosystem/action-regex-match@v2
Expand Down

0 comments on commit 1bc67d5

Please sign in to comment.