Skip to content

Commit b86785a

Browse files
authored
ci: use npm ci with caching in all CI workflows (#9150)
Switch all GitHub Actions workflows from `npm install` to `npm ci` and enable npm caching via `actions/setup-node`. This hardens CI against supply chain attacks by ensuring only lockfile-pinned versions are installed, and speeds up installs by caching downloaded tarballs.
1 parent 70965ff commit b86785a

7 files changed

Lines changed: 12 additions & 6 deletions

File tree

.github/workflows/docs-check.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ jobs:
2121
uses: actions/setup-node@v4
2222
with:
2323
node-version-file: '.nvmrc'
24+
cache: 'npm'
2425

2526
# - name: Filter modified codepaths
2627
# uses: dorny/paths-filter@v3
@@ -38,7 +39,7 @@ jobs:
3839

3940
- name: Build docs
4041
run: |-
41-
npm install -w docs
42+
npm ci -w docs
4243
npm run build -w docs
4344
# https://typicode.github.io/husky/how-to.html#ci-server-and-docker
4445
env:

.github/workflows/prettier.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ jobs:
1212
uses: actions/setup-node@v4
1313
with:
1414
node-version-file: '.nvmrc'
15+
cache: 'npm'
1516

1617
- name: NPM Install
17-
run: npm install
18+
run: npm ci
1819
# https://typicode.github.io/husky/how-to.html#ci-server-and-docker
1920
env:
2021
HUSKY: 0

.github/workflows/rill-ui.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ jobs:
6969
uses: actions/setup-node@v4
7070
with:
7171
node-version-file: '.nvmrc'
72+
cache: 'npm'
7273

7374
- name: Setup Env variables from Inputs for Prod
7475
if: ( github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') ) || ( github.event_name == 'workflow_dispatch' && inputs.env == 'prod' )
@@ -93,7 +94,7 @@ jobs:
9394
9495
- name: Build Cloud UI
9596
run: |-
96-
npm install
97+
npm ci
9798
npm run build -w web-admin
9899
env:
99100
RILL_UI_PUBLIC_RILL_ADMIN_URL: https://admin.${{ env.DOMAIN }}

.github/workflows/web-test-code-quality.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
uses: actions/setup-node@v4
3535
with:
3636
node-version-file: '.nvmrc'
37+
cache: 'npm'
3738

3839
- name: Web code quality checks
3940
run: bash ./scripts/web-test-code-quality.sh

.github/workflows/web-test-e2e.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,10 @@ jobs:
8181
uses: actions/setup-node@v4
8282
with:
8383
node-version-file: '.nvmrc'
84+
cache: 'npm'
8485

8586
- name: NPM Install
86-
run: npm install
87+
run: npm ci
8788
# https://typicode.github.io/husky/how-to.html#ci-server-and-docker
8889
env:
8990
HUSKY: 0

.github/workflows/web-test-unit-tests.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@ jobs:
2929
uses: actions/setup-node@v4
3030
with:
3131
node-version-file: '.nvmrc'
32+
cache: 'npm'
3233

3334
- name: NPM Install
34-
run: npm install
35+
run: npm ci
3536
# https://typicode.github.io/husky/how-to.html#ci-server-and-docker
3637
env:
3738
HUSKY: 0

scripts/web-test-code-quality.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ echo "filters: admin=$ADMIN local=$LOCAL common=$COMMON"
7070
echo ""
7171
echo "== NPM Install =="
7272
# https://typicode.github.io/husky/how-to.html#ci-server-and-docker
73-
HUSKY=0 npm install
73+
HUSKY=0 npm ci
7474

7575
if [[ "$COMMON" == "true" ]]; then
7676
echo ""

0 commit comments

Comments
 (0)