Skip to content

Commit 056590b

Browse files
committed
Simplify GitHub Actions workflows by using pnpm cache and setup-node
1 parent 3a10765 commit 056590b

File tree

4 files changed

+21
-49
lines changed

4 files changed

+21
-49
lines changed

.github/workflows/algolia-index.yml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v4
12-
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
13-
id: setup-node
14-
with:
15-
node-version-file: 'package.json'
1612
- uses: dorny/paths-filter@v3
1713
id: filter
1814
with:
@@ -31,16 +27,13 @@ jobs:
3127
with:
3228
version: 10
3329

34-
- uses: actions/cache@v4
35-
id: cache
30+
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
31+
id: setup-node
3632
with:
37-
path: ~/.pnpm-store
38-
key: pnpm-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
39-
restore-keys: |
40-
pnpm-${{ runner.os }}-
33+
node-version-file: 'package.json'
34+
cache: 'pnpm'
4135

4236
- run: pnpm install --frozen-lockfile
43-
if: steps.cache.outputs.cache-hit != 'true'
4437

4538
# bun seems to be the most straightforward way to run a TypeScript script
4639
# without introducing another dependency like ts-node or tsx for everyone else

.github/workflows/lint-404s.yml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v4
14-
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
15-
id: setup-node
16-
with:
17-
node-version-file: 'package.json'
1814
- uses: dorny/paths-filter@v3
1915
id: filter
2016
with:
@@ -33,16 +29,13 @@ jobs:
3329
with:
3430
version: 10
3531

36-
- uses: actions/cache@v4
37-
id: cache
32+
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
33+
id: setup-node
3834
with:
39-
path: ~/.pnpm-store
40-
key: pnpm-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
41-
restore-keys: |
42-
pnpm-${{ runner.os }}-
35+
node-version-file: 'package.json'
36+
cache: 'pnpm'
4337

4438
- run: pnpm install --frozen-lockfile
45-
if: steps.cache.outputs.cache-hit != 'true'
4639

4740
- run: pnpm build
4841
if: steps.filter.outputs.docs == 'true'

.github/workflows/sync-labels.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,15 @@ jobs:
2323
steps:
2424
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
2525

26+
- uses: pnpm/action-setup@v4
27+
with:
28+
version: 10
29+
2630
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
2731
id: setup-node
2832
with:
2933
node-version-file: 'package.json'
30-
31-
- uses: pnpm/action-setup@v4
32-
with:
33-
version: 10
34+
cache: 'pnpm'
3435

3536
- name: Install github-label-sync
3637
run: pnpm add -g [email protected]

.github/workflows/test.yml

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,17 @@ jobs:
2121
app_id: ${{ vars.SENTRY_INTERNAL_APP_ID }}
2222
private_key: ${{ secrets.SENTRY_INTERNAL_APP_PRIVATE_KEY }}
2323

24-
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
25-
id: setup-node
26-
with:
27-
node-version-file: 'package.json'
28-
2924
- uses: pnpm/action-setup@v4
3025
with:
3126
version: 10
3227

33-
- uses: actions/cache@v4
34-
id: cache
28+
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
29+
id: setup-node
3530
with:
36-
path: ~/.pnpm-store
37-
key: pnpm-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
38-
restore-keys: |
39-
pnpm-${{ runner.os }}-
31+
node-version-file: 'package.json'
32+
cache: 'pnpm'
4033

4134
- run: pnpm install --frozen-lockfile
42-
if: steps.cache.outputs.cache-hit != 'true'
4335

4436
# Additional checks
4537
- run: pnpm lint:ts
@@ -69,24 +61,17 @@ jobs:
6961
runs-on: ubuntu-latest
7062
steps:
7163
- uses: actions/[email protected]
72-
- name: Set up Node
73-
uses: actions/setup-node@v4
74-
with:
75-
node-version-file: 'package.json'
7664

7765
- uses: pnpm/action-setup@v4
7866
with:
7967
version: 10
8068

81-
- uses: actions/cache@v4
82-
id: cache
69+
- name: Set up Node
70+
uses: actions/setup-node@v4
8371
with:
84-
path: ~/.pnpm-store
85-
key: pnpm-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
86-
restore-keys: |
87-
pnpm-${{ runner.os }}-
72+
node-version-file: 'package.json'
73+
cache: 'pnpm'
8874

8975
- run: pnpm install --frozen-lockfile
90-
if: steps.cache.outputs.cache-hit != 'true'
9176
- name: Run Tests
9277
run: pnpm test

0 commit comments

Comments
 (0)