Skip to content

Commit

Permalink
fix(ci): change pnpm cache logic and check style all files (#1859)
Browse files Browse the repository at this point in the history
* feat(ci): update pnpm action setup and change cache logic

* fix(ci): install only dev dependencies and check style all files

* fix: add shell property in setup pnpm
  • Loading branch information
dayongkr authored Aug 18, 2024
1 parent 2544667 commit 91b4e0a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
22 changes: 7 additions & 15 deletions .github/actions/setup-pnpm/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,16 @@ inputs:
runs:
using: 'composite'
steps:
- uses: pnpm/action-setup@v3
- uses: actions/setup-node@v4
- name: Checkout repository
uses: pnpm/action-setup@v4
with:
node-version: 20

# https://github.com/pnpm/action-setup/tree/v2/?tab=readme-ov-file#use-cache-to-reduce-installation-time
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
run_install: false

- uses: actions/cache@v4
name: Setup pnpm cache
- name: Setup Node.js and pnpm
uses: actions/setup-node@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
node-version: 20
cache: 'pnpm'

- name: Install dependencies
if: ${{ inputs.install == 'yes' }}
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ jobs:
fetch-depth: 0

- uses: ./.github/actions/setup-pnpm
with:
install: 'no'

- name: Install dev dependencies
run: pnpm install --dev

- name: Set up Go
uses: actions/setup-go@v5
Expand All @@ -138,7 +143,7 @@ jobs:
run: echo "${{ github.event.pull_request.title }}" | pnpm commitlint --verbose

- name: Check style (Node.js)
run: git diff --name-only --diff-filter=ACMRUXB origin/main | grep -E "(.ts$|.tsx$|.js$|.jsx$)" | xargs -r pnpm prettier -c
run: git diff --name-only --diff-filter=ACMRUXB origin/main | xargs -r pnpm prettier -c --ignore-unknown

- name: Check Style (Go)
run: |
Expand Down

0 comments on commit 91b4e0a

Please sign in to comment.