From 3de8df851dda7b7b385dc8111061fd513535da2f Mon Sep 17 00:00:00 2001
From: jdx <216188+jdx@users.noreply.github.com>
Date: Fri, 31 Oct 2025 09:27:59 -0500
Subject: [PATCH] fix: auto-update dist folder in Renovate PRs via GitHub
Actions (#306)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
## Summary
Fixes the artifact update problem in Renovate PRs (like #294) by
replacing non-functional `postUpgradeTasks` configuration with a GitHub
Actions workflow.
## Problem
The previous configuration used `postUpgradeTasks` and `allowedCommands`
in `.github/renovate.json`, which only work with self-hosted Renovate.
Since this repo uses GitHub's hosted Renovate app, those settings were
being ignored, causing the `dist/` folder to not be updated
automatically.
## Solution
Created a new GitHub Actions workflow
(`.github/workflows/renovate-dist-update.yml`) that:
- Automatically triggers when Renovate opens a PR that modifies
`package.json`, `package-lock.json`, or `src/`
- Only runs for Renovate bot PRs
- Runs `npm run all` to rebuild the distribution
- Commits and pushes the updated `dist/` folder back to the PR branch
Also cleaned up `.github/renovate.json` by removing the non-functional
configuration.
## Testing
The workflow will automatically run on the next Renovate PR update. You
can test it immediately by:
1. Closing and reopening PR #294, or
2. Waiting for the next Renovate update cycle
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---
> [!NOTE]
> Replace Renovate post-upgrade tasks with a GitHub Actions workflow
that rebuilds and commits `dist/` on Renovate PRs.
>
> - **CI / GitHub Actions**:
> - Add `/.github/workflows/renovate-dist-update.yml` to auto-rebuild
`dist/` on Renovate PRs.
> - Triggers on changes to `package.json`, `package-lock.json`,
`src/**`, `tsconfig.json`.
> - Runs only for `renovate[bot]`/`renovate-bot`; executes `npm ci` and
`npm run all`; commits updated `dist/` if changed.
> - **Renovate Config**:
> - Simplify `/.github/renovate.json` by removing `postUpgradeTasks` and
`allowedCommands`, keeping only `extends`.
>
> Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
631581469eea37c64b833bd5d7119d1860fec0f3. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).
Co-authored-by: Claude
---
.github/renovate.json | 21 +--------
.github/workflows/renovate-dist-update.yml | 52 ++++++++++++++++++++++
2 files changed, 53 insertions(+), 20 deletions(-)
create mode 100644 .github/workflows/renovate-dist-update.yml
diff --git a/.github/renovate.json b/.github/renovate.json
index 1c18c5a..75e5065 100644
--- a/.github/renovate.json
+++ b/.github/renovate.json
@@ -1,23 +1,4 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
- "extends": ["github>jdx/renovate-config"],
- "packageRules": [
- {
- "matchManagers": ["github-actions"],
- "postUpgradeTasks": {
- "commands": [],
- "fileFilters": [],
- "executionMode": "branch"
- }
- },
- {
- "matchManagers": ["npm"],
- "postUpgradeTasks": {
- "commands": ["npm run all"],
- "fileFilters": ["dist/**/*"],
- "executionMode": "branch"
- }
- }
- ],
- "allowedCommands": ["^npm run all$"]
+ "extends": ["github>jdx/renovate-config"]
}
diff --git a/.github/workflows/renovate-dist-update.yml b/.github/workflows/renovate-dist-update.yml
new file mode 100644
index 0000000..4325c94
--- /dev/null
+++ b/.github/workflows/renovate-dist-update.yml
@@ -0,0 +1,52 @@
+name: Update Distribution on Renovate PRs
+
+on:
+ pull_request:
+ paths:
+ - 'package.json'
+ - 'package-lock.json'
+ - 'src/**'
+ - 'tsconfig.json'
+
+permissions:
+ contents: write
+ pull-requests: write
+
+jobs:
+ update-dist:
+ # Only run for Renovate PRs
+ if: github.actor == 'renovate[bot]' || github.actor == 'renovate-bot'
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout PR branch
+ uses: actions/checkout@v4
+ with:
+ ref: ${{ github.head_ref }}
+ token: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Setup Node.js
+ uses: actions/setup-node@v4
+ with:
+ node-version: '20'
+ cache: 'npm'
+
+ - name: Install dependencies
+ run: npm ci
+
+ - name: Build and package
+ run: npm run all
+
+ - name: Check for changes
+ id: git-check
+ run: |
+ git diff --exit-code dist/ || echo "changed=true" >> $GITHUB_OUTPUT
+
+ - name: Commit and push changes
+ if: steps.git-check.outputs.changed == 'true'
+ run: |
+ git config user.name "github-actions[bot]"
+ git config user.email "github-actions[bot]@users.noreply.github.com"
+ git add dist/
+ git commit -m "chore: rebuild distribution"
+ git push