Skip to content

Commit

Permalink
cache node_modules the same in all workflows (#3077)
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbe authored Mar 12, 2021
1 parent ad98b98 commit 76c5613
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
19 changes: 9 additions & 10 deletions .github/workflows/pr-check_redirects.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,18 @@ jobs:
with:
node-version: "12"

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2.1.4
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
- name: Cache node_modules
uses: actions/cache@v2.1.4
id: cached-node_modules
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
path: |
node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}

- name: Install all yarn packages
run: yarn --frozen-lockfile
if: steps.cached-node_modules.outputs.cache-hit != 'true'
run: |
yarn --frozen-lockfile
- name: Check redirects file(s)
run: yarn content validate-redirects en-us --strict
19 changes: 9 additions & 10 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,18 @@ jobs:
with:
node-version: "12"

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2.1.4
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
- name: Cache node_modules
uses: actions/cache@v2.1.4
id: cached-node_modules
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
path: |
node_modules
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}

- name: Install all yarn packages
run: yarn --frozen-lockfile
if: steps.cached-node_modules.outputs.cache-hit != 'true'
run: |
yarn --frozen-lockfile
- name: Start the Yari server
run: |
Expand Down

0 comments on commit 76c5613

Please sign in to comment.