Skip to content

Commit 4c004cf

Browse files
committedJan 8, 2025
chore(ci): add pnpm lockfile consistency check workflow
1 parent 8a4b42b commit 4c004cf

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
 
+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Pnpm Lockfile Check
2+
3+
on:
4+
pull_request:
5+
branches: ["*"]
6+
7+
jobs:
8+
check-lockfile:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- uses: actions/setup-node@v4
14+
with:
15+
node-version: 23.3.0
16+
17+
- uses: pnpm/action-setup@v3
18+
with:
19+
version: 9.15.0
20+
21+
- name: Check if lockfile is up-to-date
22+
id: lockfile-check
23+
run: |
24+
# Try to install with frozen lockfile
25+
if ! pnpm install --frozen-lockfile; then
26+
echo "::error::Lockfile is out of date. Please run 'pnpm install --no-frozen-lockfile' and commit the updated pnpm-lock.yaml"
27+
echo "failed=true" >> $GITHUB_OUTPUT
28+
exit 1
29+
fi
30+
31+
- name: Comment on PR
32+
if: failure() && steps.lockfile-check.outputs.failed == 'true'
33+
uses: actions/github-script@v7
34+
with:
35+
script: |
36+
github.rest.issues.createComment({
37+
issue_number: context.issue.number,
38+
owner: context.repo.owner,
39+
repo: context.repo.repo,
40+
body: '❌ The pnpm-lockfile is out of date. Please run `pnpm install --no-frozen-lockfile` and commit the updated pnpm-lock.yaml file.'
41+
})

0 commit comments

Comments
 (0)