Skip to content

Commit 2cff116

Browse files
committed
Add workflow to auto-regenerate pnpm-lock.yaml for Dependabot PRs
Dependabot sometimes fails to update the lockfile in pnpm workspace setups, causing CI to fail with frozen-lockfile errors (see PR #308). This workflow detects Dependabot PRs, runs pnpm install to regenerate the lockfile, and commits it back. Uses a GitHub App token so that subsequent CI runs are triggered automatically.
1 parent 8e594d9 commit 2cff116

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Fix Dependabot Lockfile
2+
3+
on:
4+
pull_request_target:
5+
branches: [main]
6+
7+
permissions:
8+
contents: write
9+
pull-requests: read
10+
11+
jobs:
12+
fix-lockfile:
13+
runs-on: ubuntu-latest
14+
if: github.actor == 'dependabot[bot]'
15+
timeout-minutes: 10
16+
17+
steps:
18+
- name: Generate GitHub App Token
19+
id: generate-token
20+
uses: actions/create-github-app-token@v3
21+
with:
22+
app-id: ${{ secrets.CLAUDE_APP_ID }}
23+
private-key: ${{ secrets.CLAUDE_APP_PRIVATE_KEY }}
24+
25+
- name: Checkout Dependabot branch
26+
uses: actions/checkout@v6
27+
with:
28+
ref: ${{ github.event.pull_request.head.ref }}
29+
token: ${{ steps.generate-token.outputs.token }}
30+
31+
- name: Set up pnpm
32+
uses: pnpm/action-setup@v5
33+
with:
34+
version: 10
35+
36+
- name: Set up Node.js
37+
uses: actions/setup-node@v6
38+
with:
39+
node-version: "22.x"
40+
41+
- name: Regenerate lockfile
42+
run: pnpm install --no-frozen-lockfile
43+
44+
- name: Commit and push if lockfile changed
45+
run: |
46+
git diff --exit-code pnpm-lock.yaml && exit 0
47+
git config user.name "github-actions[bot]"
48+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
49+
git add pnpm-lock.yaml
50+
git commit -m "fix(deps): regenerate pnpm-lock.yaml"
51+
git push

0 commit comments

Comments
 (0)