Skip to content

Commit f9bd8ff

Browse files
committed
fix: use a composite action
1 parent ba4222a commit f9bd8ff

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
1-
name: NPM Install
2-
run-name: "Runner (${{ inputs.runner }}) / Node (${{ inputs.node-version }})"
1+
name: 'NPM Setup'
2+
description: 'Sets up Node.js and installs NPM dependencies with caching'
33

4-
on:
5-
workflow_call:
6-
inputs:
7-
runner:
8-
required: true
9-
type: string
10-
node-version:
11-
required: true
12-
type: string
4+
inputs:
5+
runner:
6+
description: 'Runner to use'
7+
required: true
8+
node-version:
9+
description: 'Node.js version to use'
10+
required: true
1311

14-
jobs:
15-
npm-install:
16-
name: "NPM Install (${{ inputs.runner }}) / Node (${{ inputs.node-version }})"
17-
runs-on: ${{ inputs.runner }}
18-
steps:
12+
runs:
13+
using: "composite"
14+
steps:
1915
- name: Install NodeJS ${{ inputs.node-version }}
2016
uses: actions/setup-node@v4
2117
with:
@@ -28,8 +24,9 @@ jobs:
2824
id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true'
2925
with:
3026
path: ${{ steps.npm-cache-dir.outputs.dir }}
31-
key: ${{ inputs.runner }}-node-{{ inputs.node-version }}-${{ hashFiles('**/package-lock.json') }}
27+
key: ${{ inputs.runner }}-node-${{ inputs.node-version }}-${{ hashFiles('**/package-lock.json') }}
3228
restore-keys: |
33-
${{ inputs.runner }}-node-{{ inputs.node-version }}-
29+
${{ inputs.runner }}-node-${{ inputs.node-version }}-
3430
- name: Install dependencies
31+
shell: bash
3532
run: npm ci --omit=optional

.github/workflows/test.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,13 @@ jobs:
2929
steps:
3030
- name: Code checkout
3131
uses: actions/checkout@v4
32-
- uses: ./.github/workflows/npm-ci.yml
32+
33+
# Uses a composite action for a consistent NPM install including cache
34+
- uses: ./.github/actions/npm-setup
3335
with:
3436
runner: ${{ matrix.runner }}
3537
node-version: ${{ matrix.node-version }}
38+
3639
- name: Build workspaces
3740
run: npm run build -ws
3841
- name: Remove dev dependencies

0 commit comments

Comments
 (0)