Skip to content

Commit 0c0c1db

Browse files
committed
chore: refactor JavaScript setup in workflows to use a composite action for pnpm installation
1 parent b140ca9 commit 0c0c1db

3 files changed

Lines changed: 34 additions & 35 deletions

File tree

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Setup JS
2+
description: Setup Node.js, pnpm, and install dependencies
3+
4+
inputs:
5+
working-directory:
6+
description: Directory to run pnpm install in
7+
required: false
8+
default: ${{ github.workspace }}
9+
10+
runs:
11+
using: composite
12+
steps:
13+
- uses: actions/setup-node@v6
14+
with:
15+
node-version: 24.x
16+
17+
- name: Install pnpm
18+
shell: bash
19+
run: npm install -g pnpm@11
20+
21+
- name: Install dependencies
22+
shell: bash
23+
working-directory: ${{ inputs.working-directory }}
24+
run: pnpm install --frozen-lockfile

.github/workflows/copilot-setup-steps.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,7 @@ jobs:
3535
9.0.x
3636
10.0.x
3737
38-
- name: Install pnpm
39-
run: npm install -g pnpm@11
40-
41-
- name: Install JavaScript dependencies
42-
run: pnpm install --frozen-lockfile
38+
- uses: ./.github/actions/setup-js
4339

4440
- name: Restore .NET packages
4541
run: dotnet restore

.github/workflows/part-build.yml

Lines changed: 9 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ jobs:
2323
8.0.x
2424
9.0.x
2525
26-
- run: npm install -g pnpm@11
27-
- run: pnpm install --frozen-lockfile
26+
- uses: ./.github/actions/setup-js
2827
- run: dotnet restore
2928
- run: dotnet build --no-restore --configuration Release /WarnAsError
3029
- run: dotnet test --no-build --configuration Release
@@ -51,9 +50,7 @@ jobs:
5150
8.0.x
5251
9.0.x
5352
54-
- run: npm install -g pnpm@11
55-
- run: pnpm install --frozen-lockfile
56-
working-directory: ${{ github.workspace }}
53+
- uses: ./.github/actions/setup-js
5754

5855
- run: pnpm coalesce
5956
- run: pnpm build
@@ -81,11 +78,7 @@ jobs:
8178
- name: Update npm
8279
run: npm install -g npm@latest
8380

84-
- name: Install pnpm
85-
run: npm install -g pnpm@11
86-
87-
- run: pnpm install --frozen-lockfile
88-
working-directory: ${{ github.workspace }}
81+
- uses: ./.github/actions/setup-js
8982

9083
- run: pnpm lint
9184

@@ -116,9 +109,7 @@ jobs:
116109
steps:
117110
- uses: actions/checkout@v6
118111

119-
- run: npm install -g pnpm@11
120-
- run: pnpm install --frozen-lockfile
121-
working-directory: ${{ github.workspace }}
112+
- uses: ./.github/actions/setup-js
122113

123114
- name: pnpm test
124115
run: pnpm test
@@ -147,9 +138,7 @@ jobs:
147138
steps:
148139
- uses: actions/checkout@v6
149140

150-
- run: npm install -g pnpm@11
151-
- run: pnpm install --frozen-lockfile
152-
working-directory: ${{ github.workspace }}
141+
- uses: ./.github/actions/setup-js
153142

154143
- name: pnpm test
155144
run: pnpm test
@@ -183,13 +172,7 @@ jobs:
183172
steps:
184173
- uses: actions/checkout@v6
185174

186-
- uses: actions/setup-node@v6
187-
with:
188-
node-version: 24.x
189-
190-
- run: npm install -g pnpm@11
191-
- run: pnpm install --frozen-lockfile
192-
working-directory: ${{ github.workspace }}
175+
- uses: ./.github/actions/setup-js
193176

194177
- run: pnpm build-local-deps # build coalesce-vue
195178
- run: pnpm build
@@ -220,9 +203,7 @@ jobs:
220203
# fetch all commits to get last updated time or other git log info
221204
fetch-depth: 0
222205

223-
- run: npm install -g pnpm@11
224-
- run: pnpm install --frozen-lockfile
225-
working-directory: ${{ github.workspace }}
206+
- uses: ./.github/actions/setup-js
226207

227208
- name: Build docs
228209
run: pnpm build
@@ -276,13 +257,11 @@ jobs:
276257
8.0.x
277258
9.0.x
278259
279-
- name: Use Node.js
280-
uses: actions/setup-node@v6
260+
- uses: actions/setup-node@v6
281261
with:
282262
node-version: 24.x
283263

284-
- name: Install pnpm
285-
run: npm install -g pnpm@11
264+
- run: npm install -g pnpm@11
286265

287266
- name: Download Artifacts
288267
uses: actions/download-artifact@v8

0 commit comments

Comments
 (0)