Skip to content

Commit cb55417

Browse files
amine7536claude
andauthored
build: add workflow to fix dependabot lockfile sync issues (#149)
Dependabot regenerates package-lock.json when bumping dependencies but drops optional peer dependencies (react-devtools-core, ws) from the lockfile. This causes `npm ci` to fail with EUSAGE errors. Add a workflow that runs `npm install --package-lock-only` on dependabot PRs to regenerate the lockfile correctly and commits the fix. https://claude.ai/code/session_01W2qSm36L1wLHWQZyqn8ywy Co-authored-by: Claude <noreply@anthropic.com>
1 parent 8cdb4a3 commit cb55417

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Fix Dependabot lockfile
2+
3+
on:
4+
pull_request:
5+
branches: [main, next]
6+
7+
permissions:
8+
contents: write
9+
pull-requests: read
10+
11+
jobs:
12+
fix-lockfile:
13+
name: Fix lockfile
14+
runs-on: ubuntu-latest
15+
if: github.actor == 'dependabot[bot]'
16+
steps:
17+
- name: Harden the runner (Audit all outbound calls)
18+
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
19+
with:
20+
egress-policy: audit
21+
22+
- name: Checkout
23+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
24+
with:
25+
ref: ${{ github.head_ref }}
26+
token: ${{ secrets.GITHUB_TOKEN }}
27+
28+
- name: Setup Node.js
29+
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
30+
with:
31+
node-version: 22
32+
33+
- name: Regenerate lockfile
34+
run: npm install --package-lock-only --ignore-scripts
35+
36+
- name: Commit updated lockfile
37+
run: |
38+
git config user.name "github-actions[bot]"
39+
git config user.email "github-actions[bot]@users.noreply.github.com"
40+
git add package-lock.json
41+
if git diff --cached --quiet; then
42+
echo "Lockfile is already in sync"
43+
else
44+
git commit -m "fix: regenerate package-lock.json"
45+
git push
46+
fi

0 commit comments

Comments
 (0)