From 779e0e69963f4bf2b0ab5c39d60d72abf63e8eda Mon Sep 17 00:00:00 2001 From: Theo Ephraim Date: Wed, 15 Apr 2026 08:58:12 -0700 Subject: [PATCH 1/2] Fix version PR not triggering CI workflow runs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commits pushed with GITHUB_TOKEN don't trigger workflow runs due to GitHub's anti-recursion guard. After the normal git push, recreate the tip commit via the GitHub REST API and force-update the branch ref so that pull_request workflows fire automatically — no PATs, GitHub Apps, or changes to user CI configs needed. Co-Authored-By: Claude Opus 4.6 (1M context) --- packages/bumpy/src/commands/ci.ts | 48 +++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/packages/bumpy/src/commands/ci.ts b/packages/bumpy/src/commands/ci.ts index 1fff8fc..d3cf629 100644 --- a/packages/bumpy/src/commands/ci.ts +++ b/packages/bumpy/src/commands/ci.ts @@ -164,6 +164,49 @@ async function autoPublish(rootDir: string, config: BumpyConfig, tag?: string): await publishCommand(rootDir, { tag }); } +// ---- GitHub API push helper ---- + +/** + * After a normal `git push`, recreate the tip commit via the GitHub REST API + * and force-update the branch ref to point at the API-created commit. + * + * Why: commits pushed with GITHUB_TOKEN don't trigger workflow runs (GitHub's + * anti-recursion guard), but commits created through the REST API *do*. + * The API commit has the same tree and parent so the PR diff is identical. + */ +async function rerouteCommitViaApi( + rootDir: string, + branch: string, + commitMsg: string, + config: BumpyConfig, +): Promise { + const treeSha = runArgs(['git', 'rev-parse', 'HEAD^{tree}'], { cwd: rootDir }); + const parentSha = runArgs(['git', 'rev-parse', 'HEAD~1'], { cwd: rootDir }); + + const commitBody = JSON.stringify({ + message: commitMsg, + tree: treeSha, + parents: [parentSha], + author: { + name: config.gitUser.name, + email: config.gitUser.email, + }, + }); + + const apiCommitSha = await runArgsAsync( + ['gh', 'api', 'repos/{owner}/{repo}/git/commits', '--input', '-', '--jq', '.sha'], + { cwd: rootDir, input: commitBody }, + ); + + const refBody = JSON.stringify({ sha: apiCommitSha, force: true }); + await runArgsAsync(['gh', 'api', `repos/{owner}/{repo}/git/refs/heads/${branch}`, '-X', 'PATCH', '--input', '-'], { + cwd: rootDir, + input: refBody, + }); + + log.dim(' Re-pushed commit via GitHub API to trigger workflow runs'); +} + // ---- version-pr mode ---- async function createVersionPr( @@ -209,7 +252,12 @@ async function createVersionPr( const commitMsg = ['Version packages', '', ...plan.releases.map((r) => `${r.name}@${r.newVersion}`)].join('\n'); runArgs(['git', 'commit', '-F', '-'], { cwd: rootDir, input: commitMsg }); + + // Push via git first to upload objects, then recreate the commit via the + // GitHub API and force-update the ref. Commits created through the REST API + // *do* trigger workflow runs, whereas commits pushed with GITHUB_TOKEN do not. runArgs(['git', 'push', '-u', 'origin', branch, '--force'], { cwd: rootDir }); + await rerouteCommitViaApi(rootDir, branch, commitMsg, config); // Create or update PR const prBody = formatVersionPrBody(plan, config.versionPr.preamble); From 1e07da54045dc94eb0388a8f7fee705d97d34135 Mon Sep 17 00:00:00 2001 From: Theo Ephraim Date: Wed, 15 Apr 2026 08:59:41 -0700 Subject: [PATCH 2/2] Add changeset for version PR CI trigger fix Co-Authored-By: Claude Opus 4.6 (1M context) --- .bumpy/fix-version-pr-ci-triggers.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .bumpy/fix-version-pr-ci-triggers.md diff --git a/.bumpy/fix-version-pr-ci-triggers.md b/.bumpy/fix-version-pr-ci-triggers.md new file mode 100644 index 0000000..24e99e4 --- /dev/null +++ b/.bumpy/fix-version-pr-ci-triggers.md @@ -0,0 +1,7 @@ +--- +'@varlock/bumpy': patch +--- + +Fix version PR not triggering CI workflow runs + +After pushing the version branch, recreate the tip commit via the GitHub REST API so that pull_request workflows fire automatically. Commits pushed with GITHUB_TOKEN don't trigger workflows due to GitHub's anti-recursion guard, but API-created commits bypass this — no PATs, GitHub Apps, or user CI config changes needed.