Skip to content

Commit 6315814

Browse files
jdxclaude
andcommitted
fix: auto-update dist folder in Renovate PRs via GitHub Actions
Replaces non-functional postUpgradeTasks configuration with a GitHub Actions workflow that automatically rebuilds the distribution when Renovate opens PRs. The previous approach used postUpgradeTasks and allowedCommands, which only work with self-hosted Renovate. Since this repo uses GitHub's hosted Renovate app, those settings were ignored, causing the dist folder to not be updated. The new workflow: - Triggers on PRs that modify package.json, package-lock.json, or src/ - Only runs for Renovate bot PRs - Runs npm run all to rebuild dist/ - Commits and pushes changes back to the PR branch This fixes the artifact update warnings in Renovate PRs like #294. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 3a0b1eb commit 6315814

2 files changed

Lines changed: 53 additions & 20 deletions

File tree

.github/renovate.json

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,4 @@
11
{
22
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3-
"extends": ["github>jdx/renovate-config"],
4-
"packageRules": [
5-
{
6-
"matchManagers": ["github-actions"],
7-
"postUpgradeTasks": {
8-
"commands": [],
9-
"fileFilters": [],
10-
"executionMode": "branch"
11-
}
12-
},
13-
{
14-
"matchManagers": ["npm"],
15-
"postUpgradeTasks": {
16-
"commands": ["npm run all"],
17-
"fileFilters": ["dist/**/*"],
18-
"executionMode": "branch"
19-
}
20-
}
21-
],
22-
"allowedCommands": ["^npm run all$"]
3+
"extends": ["github>jdx/renovate-config"]
234
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Update Distribution on Renovate PRs
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'package.json'
7+
- 'package-lock.json'
8+
- 'src/**'
9+
- 'tsconfig.json'
10+
11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
15+
jobs:
16+
update-dist:
17+
# Only run for Renovate PRs
18+
if: github.actor == 'renovate[bot]' || github.actor == 'renovate-bot'
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout PR branch
23+
uses: actions/checkout@v4
24+
with:
25+
ref: ${{ github.head_ref }}
26+
token: ${{ secrets.GITHUB_TOKEN }}
27+
28+
- name: Setup Node.js
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: '20'
32+
cache: 'npm'
33+
34+
- name: Install dependencies
35+
run: npm ci
36+
37+
- name: Build and package
38+
run: npm run all
39+
40+
- name: Check for changes
41+
id: git-check
42+
run: |
43+
git diff --exit-code dist/ || echo "changed=true" >> $GITHUB_OUTPUT
44+
45+
- name: Commit and push changes
46+
if: steps.git-check.outputs.changed == 'true'
47+
run: |
48+
git config user.name "github-actions[bot]"
49+
git config user.email "github-actions[bot]@users.noreply.github.com"
50+
git add dist/
51+
git commit -m "chore: rebuild distribution"
52+
git push

0 commit comments

Comments
 (0)