Skip to content

Add label-triggered workflow to rebuild the action bundle#47

Merged
fengmk2 merged 2 commits into
mainfrom
rebuild-bundle-workflow
Jul 1, 2026
Merged

Add label-triggered workflow to rebuild the action bundle#47
fengmk2 merged 2 commits into
mainfrom
rebuild-bundle-workflow

Conversation

@fengmk2

@fengmk2 fengmk2 commented Jul 1, 2026

Copy link
Copy Markdown
Member

Completes the bundle-freshness automation. Pairs with the needs-bundle-rebuild label (created) and the Renovate rule in #46.

Flow

  1. Renovate bumps a bundled dep (nanotar/esbuild) → adds the needs-bundle-rebuild label (Renovate: honor pnpm's minimum-release-age and flag bundle-affecting deps #46's rule).
  2. This workflow fires on pull_request: labeled, guarded to that label, rebuilds via pnpm build:action, and pushes the refreshed .github/actions/publish-preview/dist if it changed.
  3. "Verify action bundle" re-runs on the pushed commit and passes.

App token

A push made with the default GITHUB_TOKEN does not re-trigger a PR's required checks (GitHub loop prevention). So it mints a GitHub App token first and checks out / pushes with it, matching the org convention (actions/create-github-app-token, client-id: APP_ID / private-key: APP_PRIVATE_KEY, same as vite-plus's update-node-release-keys.yml).

Needs the APP_ID and APP_PRIVATE_KEY secrets available to this repo (org-level, or granted). The App needs contents: write on the repo.

Same-repo PRs only (fork branches can't be pushed to; Renovate is same-repo).

fengmk2 added 2 commits July 1, 2026 15:42
When the needs-bundle-rebuild label lands on a PR (Renovate adds it for bumps to
deps compiled into the publish-action bundle), rebuild the bundle and push the
refreshed dist so the "Verify action bundle" check passes without a manual
`pnpm build:action`.

Prefers a BUNDLE_REBUILD_TOKEN secret so the push re-triggers required checks;
falls back to GITHUB_TOKEN (which commits the fresh dist but can't re-run CI, per
GitHub's loop-prevention). Same-repo PRs only.
Mint an App token (actions/create-github-app-token, client-id: APP_ID /
private-key: APP_PRIVATE_KEY, matching the org convention in vite-plus) and
checkout/push with it, so the push re-triggers the PR's required checks. Drops
the GITHUB_TOKEN fallback.
@fengmk2 fengmk2 merged commit 823dd6e into main Jul 1, 2026
4 checks passed
@fengmk2 fengmk2 deleted the rebuild-bundle-workflow branch July 1, 2026 07:53
fengmk2 added a commit to voidzero-dev/setup-vp that referenced this pull request Jul 1, 2026
Renovate bumps to bundled deps (\`@actions/*\`, \`yaml\`, \`zod\`) or to
the \`vite-plus\` bundler change \`dist/index.mjs\`, which fails the
"Verify dist is up to date" check until someone manually runs \`vp run
build\` and commits.

This adapts the label-triggered rebuild approach from
voidzero-dev/pkg-pr-registry-bridge#47:

- New \`.github/workflows/rebuild-bundle.yml\`: on the
\`needs-bundle-rebuild\` label (same-repo PRs only), rebuild \`dist/\`
and push it back to the PR branch. Uses a GitHub App token so the push
re-triggers the PR's required checks.
- \`.github/renovate.json\`: attach the \`needs-bundle-rebuild\` label
to runtime \`dependencies\` and to \`vite-plus\`, the bumps that can
change the bundle.

Relies on the org secrets \`APP_ID\` / \`APP_PRIVATE_KEY\` (same
App/secrets as the reference repo).
fengmk2 added a commit that referenced this pull request Jul 1, 2026
The `needs-bundle-rebuild` label already triggers `rebuild-bundle.yml`
(added in #47), which re-runs `pnpm build:action` and pushes the
refreshed dist. The `prBodyNote` still instructed maintainers to do that
by hand, so following it caused duplicate/racing pushes
(non-fast-forward rejects) once the bot had already pushed.

Rewrite the note and the rule's internal description to state the
rebuild happens automatically via the label, with a fork-PR fallback
(the bot can't push to fork branches).

Config-only, no behavior change to the automation itself. Surfaced by a
code review of the recent Renovate/bundle-rebuild changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant