[PR #44] [MERGED] fix(bump-callers): reuse one open PR per repo via a stable branch (BE-3882) #55

Closed
opened 2026-10-26 22:35:46 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Comfy-Org/github-workflows/pull/44
Author: @mattmillerai
Created: 7/21/2026
Status: ✅ Merged
Merged: 7/21/2026
Merged by: @mattmillerai

Base: main ← Head: matt/be-3882-stable-bump-branch


📝 Commits (3)

  • eec9b38 fix(bump-callers): reuse one open PR per repo via a stable branch (BE-3882)
  • 92330d8 fix(bump-callers): guard existing-PR lookup + fail loud on create error (BE-3882)
  • f08a97e fix(bump-callers): commit all of a repo's files onto one bump branch (BE-3896) (#45)

📊 Changes

5 files changed (+465 additions, -71 deletions)

View changed files

📝 .github/bump-callers/README.md (+10 -4)
📝 .github/bump-callers/bump-callers.sh (+229 -65)
📝 .github/bump-callers/tests/test_bump_callers.sh (+204 -2)
📝 .github/workflows/bump-agents-md-callers.yml (+11 -0)
📝 .github/workflows/bump-cursor-review-callers.yml (+11 -0)

📄 Description

ELI-5

When we update a shared workflow here, a bot goes to every repo that uses it and opens a PR to point at the new version. The bug: it named each PR's branch after the new version's ID, so every update opened a brand-new PR and left the old ones sitting open — a growing pile where you couldn't tell which pin was current.

Now the bot uses one fixed branch name per repo (ci/bump-<tag>). On the next update it reuses that same branch — rebuilding it fresh from the repo's current main and refreshing the existing PR's diff/title/body — instead of opening another. So there's at most one open bump PR per repo per workflow at any time, always showing the latest pin.

What changed

.github/bump-callers/bump-callers.sh (the one shared script behind both the bump-cursor-review-callers and bump-agents-md-callers fleets):

  1. Stable branch — BRANCH="ci/bump-${TAG}" (dropped the ${SHORT} suffix). The SHA now lives only in the commit/title/body.
  2. Rebuild from the tip every run — create the branch at the caller's current default-branch tip, or PATCH-force it back to the tip if it already exists, then apply the single file-pin change. The PR diff is always a clean single "bump to @SHORT" commit — no accumulated stale commits, no drift if the caller's main moved.
  3. Update-in-place vs create — gh pr list --head "$BRANCH" --state open decides: if a bump PR is already open, gh pr edit refreshes its title/body (they embed ${SHORT}) — no second PR. If none is open (first bump, or the prior one merged/closed since last run), gh pr create opens a fresh single one.

Acceptance criteria

  • ✅ At most one open bump PR per (repo, workflow) at any time.
  • ✅ A subsequent bump updates that PR's branch + title/body rather than opening another.
  • ✅ If the open PR was merged/closed since last run, the next bump opens a fresh single one (the --state open check falls through to create; a residual branch is force-reset first).
  • ✅ PR diff stays a clean single "bump to @SHORT" change vs the caller's current default branch.
  • ✅ Fix lives in the shared bump-callers.sh, so it applies to both the cursor-review and agents-md dispatchers.

Tests

bash .github/bump-callers/tests/test_bump_callers.sh + shellcheck -x — 33/33 pass. Added coverage for the new update-in-place path (open PR is edited, not re-opened) and asserted the create path does no edit when no PR is open. The gh stub gained pr list/pr edit/PATCH handling and a STUB_OPEN_PR toggle.

Judgment calls / notes

  • Force-reset of the bump branch is intentional and safe: the target is always a bot-owned ci/bump-* branch, so the only thing discarded is the prior bump commit — exactly what we're replacing. It does refresh an open PR's diff out from under any in-progress review, but that's the desired "update to latest SHA" behavior for an automated bump PR.
  • Labels are not re-added on the update-in-place path — the fleet label is applied at PR creation and persists; the ticket only calls for refreshing title/body on update.
  • --field force=true relies on gh's typed --field form sending a JSON boolean (same --field form the script already uses); confirmed against the refs PATCH API.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Comfy-Org/github-workflows/pull/44 **Author:** [@mattmillerai](https://github.com/mattmillerai) **Created:** 7/21/2026 **Status:** ✅ Merged **Merged:** 7/21/2026 **Merged by:** [@mattmillerai](https://github.com/mattmillerai) **Base:** `main` ← **Head:** `matt/be-3882-stable-bump-branch` --- ### 📝 Commits (3) - [`eec9b38`](https://github.com/Comfy-Org/github-workflows/commit/eec9b380a3340ccd6564f45c34740dd45048350f) fix(bump-callers): reuse one open PR per repo via a stable branch (BE-3882) - [`92330d8`](https://github.com/Comfy-Org/github-workflows/commit/92330d88f95b137d2c1ca6430bf663b0d68eb1dd) fix(bump-callers): guard existing-PR lookup + fail loud on create error (BE-3882) - [`f08a97e`](https://github.com/Comfy-Org/github-workflows/commit/f08a97e56de55588b8f431955fcf925b04a90ab9) fix(bump-callers): commit all of a repo's files onto one bump branch (BE-3896) (#45) ### 📊 Changes **5 files changed** (+465 additions, -71 deletions) <details> <summary>View changed files</summary> 📝 `.github/bump-callers/README.md` (+10 -4) 📝 `.github/bump-callers/bump-callers.sh` (+229 -65) 📝 `.github/bump-callers/tests/test_bump_callers.sh` (+204 -2) 📝 `.github/workflows/bump-agents-md-callers.yml` (+11 -0) 📝 `.github/workflows/bump-cursor-review-callers.yml` (+11 -0) </details> ### 📄 Description ## ELI-5 When we update a shared workflow here, a bot goes to every repo that uses it and opens a PR to point at the new version. The bug: it named each PR's branch after the new version's ID, so **every** update opened a **brand-new** PR and left the old ones sitting open — a growing pile where you couldn't tell which pin was current. Now the bot uses **one fixed branch name per repo** (`ci/bump-<tag>`). On the next update it reuses that same branch — rebuilding it fresh from the repo's current main and refreshing the existing PR's diff/title/body — instead of opening another. So there's **at most one open bump PR per repo per workflow** at any time, always showing the latest pin. ## What changed `.github/bump-callers/bump-callers.sh` (the one shared script behind both the `bump-cursor-review-callers` and `bump-agents-md-callers` fleets): 1. **Stable branch** — `BRANCH="ci/bump-${TAG}"` (dropped the `${SHORT}` suffix). The SHA now lives only in the commit/title/body. 2. **Rebuild from the tip every run** — create the branch at the caller's current default-branch tip, or `PATCH`-force it back to the tip if it already exists, then apply the single file-pin change. The PR diff is always a clean single "bump to @SHORT" commit — no accumulated stale commits, no drift if the caller's main moved. 3. **Update-in-place vs create** — `gh pr list --head "$BRANCH" --state open` decides: if a bump PR is already open, `gh pr edit` refreshes its title/body (they embed `${SHORT}`) — no second PR. If none is open (first bump, or the prior one merged/closed since last run), `gh pr create` opens a fresh single one. ## Acceptance criteria - ✅ At most one open bump PR per (repo, workflow) at any time. - ✅ A subsequent bump updates that PR's branch + title/body rather than opening another. - ✅ If the open PR was merged/closed since last run, the next bump opens a fresh single one (the `--state open` check falls through to create; a residual branch is force-reset first). - ✅ PR diff stays a clean single "bump to @SHORT" change vs the caller's current default branch. - ✅ Fix lives in the shared `bump-callers.sh`, so it applies to both the cursor-review and agents-md dispatchers. ## Tests `bash .github/bump-callers/tests/test_bump_callers.sh` + `shellcheck -x` — **33/33 pass**. Added coverage for the new update-in-place path (open PR is edited, not re-opened) and asserted the create path does no edit when no PR is open. The `gh` stub gained `pr list`/`pr edit`/`PATCH` handling and a `STUB_OPEN_PR` toggle. ## Judgment calls / notes - **Force-reset of the bump branch** is intentional and safe: the target is always a bot-owned `ci/bump-*` branch, so the only thing discarded is the prior bump commit — exactly what we're replacing. It does refresh an open PR's diff out from under any in-progress review, but that's the desired "update to latest SHA" behavior for an automated bump PR. - **Labels are not re-added on the update-in-place path** — the fleet label is applied at PR creation and persists; the ticket only calls for refreshing title/body on update. - **`--field force=true`** relies on gh's typed `--field` form sending a JSON boolean (same `--field` form the script already uses); confirmed against the refs `PATCH` API. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-26 22:35:46 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Comfy-Org/github-workflows#55
No description provided.