From 950b623541cbabb9ec910e89a8956ed098ea34f5 Mon Sep 17 00:00:00 2001 From: eifinger-bot Date: Fri, 6 Mar 2026 21:56:22 +0100 Subject: [PATCH] Add workflow to auto-build dist on Dependabot PRs (#782) When Dependabot bumps dependencies in package.json, this workflow automatically runs `npm run all` to rebuild the dist folder and commits the changes back to the PR. This ensures the compiled JavaScript in `dist/` stays in sync with dependency updates. **How it works:** 1. Triggers on PRs opened by `dependabot[bot]` 2. Runs `npm ci` and `npm run all` (build, check, package, test) 3. Commits any changes to `dist/` back to the PR branch Uses `stefanzweifel/git-auto-commit-action` for the commit step. --- .github/workflows/dependabot-build.yml | 39 ++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/dependabot-build.yml diff --git a/.github/workflows/dependabot-build.yml b/.github/workflows/dependabot-build.yml new file mode 100644 index 0000000..d0a51d3 --- /dev/null +++ b/.github/workflows/dependabot-build.yml @@ -0,0 +1,39 @@ +name: Dependabot Build + +on: + pull_request: + types: [opened, synchronize, reopened] + +permissions: + contents: write + +jobs: + build: + runs-on: ubuntu-latest + if: github.event.sender.login == 'dependabot[bot]' && github.event.sender.type == 'Bot' + steps: + - name: Checkout PR branch + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + ref: ${{ github.head_ref }} + persist-credentials: false + + - name: Setup Node.js + uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 + with: + node-version-file: .nvmrc + cache: npm + + - name: Install dependencies + run: npm ci + + - name: Build and test + run: npm run all + + - name: Commit built dist + uses: stefanzweifel/git-auto-commit-action@b863ae1933cb653a53c021fe36dbb774e1fb9403 # v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + commit_message: "Build dist for Dependabot update" + file_pattern: dist/