Skip to content
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 114 additions & 0 deletions .github/workflows/update-renovate-dist.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: Update Renovate dist

on:
pull_request:
types: [opened, reopened, synchronize]
branches:
- main
paths:
- package.json
- pnpm-lock.yaml

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true

permissions:
contents: read

jobs:
build:
if: >-
github.event.pull_request.user.login == 'renovate[bot]' &&
github.event.pull_request.user.id == 29139614 &&
github.event.pull_request.head.repo.full_name == github.repository &&
startsWith(github.event.pull_request.head.ref, 'renovate/rolldown-')
runs-on: ubuntu-latest
outputs:
changed: ${{ steps.diff.outputs.changed }}

steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.event.pull_request.head.sha }}
persist-credentials: false

- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: .node-version

- name: Enable Corepack
run: corepack enable

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Rebuild dist
run: pnpm run all

- name: Check generated files
id: diff
shell: bash
run: |
if git diff --quiet -- dist/; then
echo "changed=false" >> "$GITHUB_OUTPUT"
else
echo "changed=true" >> "$GITHUB_OUTPUT"
fi

- name: Upload generated dist
if: steps.diff.outputs.changed == 'true'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: renovate-dist-${{ github.run_id }}
path: dist/
retention-days: 1

update:
needs: build
if: needs.build.outputs.changed == 'true'
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0
persist-credentials: true

- name: Verify pull request head
shell: bash
env:
EXPECTED_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
if [ "$(git rev-parse HEAD)" != "$EXPECTED_HEAD_SHA" ]; then
echo "The pull request branch changed while dist was being generated."
echo "A newer workflow run will regenerate dist for the new head."
exit 1
fi

- name: Download generated dist
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: renovate-dist-${{ github.run_id }}
path: dist/

- name: Commit generated dist
shell: bash
env:
HEAD_BRANCH: ${{ github.event.pull_request.head.ref }}
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add dist/

if git diff --cached --quiet; then
echo "Generated dist is already up to date."
exit 0
fi

git commit -m "Regenerate dist for Rolldown update"
git push origin "HEAD:$HEAD_BRANCH"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Trigger CI after committing the generated bundle

Whenever Rolldown changes dist/, this push uses the persisted repository GITHUB_TOKEN; GitHub documents that events caused by that token do not create new workflow runs (Triggering a workflow from a workflow). Consequently, the runs from check-dist.yml, lint.yml, and especially the Android matrix in test.yml remain associated with the pre-generation SHA, so the newly committed production bundle is never tested and required latest-head checks may remain missing. Push with credentials that trigger workflows, or run the complete downstream validation against the generated commit before updating the branch.

Useful? React with 👍 / 👎.

9 changes: 9 additions & 0 deletions renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@
'/@actions/cache/',
],
},
{
automerge: false,
matchManagers: [
'npm',
],
matchPackageNames: [
'rolldown',
],
},
{
groupName: 'Android Gradle Plugin',
matchPackageNames: [
Expand Down
Loading