refactor: use composite action for node/pnpm setup

This commit is contained in:
taroj1205 2025-06-18 13:52:34 +12:00
parent ce72a77f02
commit 8e4107d7f4
No known key found for this signature in database
GPG key ID: 0FCB6CFFE0981AB7
2 changed files with 10 additions and 37 deletions

View file

@ -21,6 +21,7 @@ runs:
${{ runner.os }}-turbo- ${{ runner.os }}-turbo-
- name: Restore node_modules cache - name: Restore node_modules cache
id: node-modules-cache
uses: actions/cache@v4 uses: actions/cache@v4
with: with:
path: | path: |
@ -40,3 +41,8 @@ runs:
with: with:
version: 10.11.0 version: 10.11.0
run_install: false run_install: false
- name: Install dependencies
if: steps.node-modules-cache.outputs.cache-hit != 'true'
shell: bash
run: pnpm install --frozen-lockfile

View file

@ -42,44 +42,11 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Restore Turborepo cache - name: Setup Node.js and pnpm
id: turbo-cache uses: ./.github/composite-actions/setup-node-pnpm
uses: actions/cache@v4
with: with:
path: .turbo turbo-cache-key: ${{ runner.os }}-turbo-${{ github.sha }}
key: ${{ runner.os }}-turbo-${{ github.sha }} node-modules-cache-key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-turbo-
lookup-only: true
- name: Restore node_modules cache
id: node-modules-cache
uses: actions/cache@v4
with:
path: |
node_modules
*/node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-node-modules-
lookup-only: true
- name: Setup Node.js
if: steps.node-modules-cache.outputs.cache-hit != 'true'
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Setup pnpm
if: steps.node-modules-cache.outputs.cache-hit != 'true'
uses: pnpm/action-setup@v4
with:
version: 10.11.0
run_install: false
- name: Install dependencies
if: steps.node-modules-cache.outputs.cache-hit != 'true'
run: pnpm install --frozen-lockfile
eslint: eslint:
name: ESLint name: ESLint