mirror of
https://github.com/Comfy-Org/github-workflows.git
synced 2026-11-05 00:17:37 +00:00
[PR #46] [MERGED] fix(bump-callers): commit each repo's files atomically via the Git Data API (BE-3902) #58
Labels
No labels
cursor-review-catalog-drift
groom
groom
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Comfy-Org/github-workflows#58
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Comfy-Org/github-workflows/pull/46
Author: @mattmillerai
Created: 7/21/2026
Status: ✅ Merged
Merged: 7/21/2026
Merged by: @mattmillerai
Base:
main← Head:matt/be-3902-atomic-git-data-commit📝 Commits (8)
eec9b38fix(bump-callers): reuse one open PR per repo via a stable branch (BE-3882)92330d8fix(bump-callers): guard existing-PR lookup + fail loud on create error (BE-3882)4455be2fix(bump-callers): commit all of a repo's files onto one bump branch (BE-3896)214a1a7fix(bump-callers): harden per-file staging against partial/erroneous bumps (BE-3896)cc45841fix(bump-callers): commit each repo's files atomically via the Git Data API (BE-3902)88f3294fix(bump-callers): pass a tree SHA (not commit SHA) as base_tree (BE-3902)5567aa2Merge remote-tracking branch 'origin/main' into matt/be-3902-atomic-git-data-commit17b8445Merge remote-tracking branch 'origin/main' into matt/be-3902-atomic-git-data-commit📊 Changes
2 files changed (+152 additions, -74 deletions)
View changed files
📝
.github/bump-callers/bump-callers.sh(+90 -46)📝
.github/bump-callers/tests/test_bump_callers.sh(+62 -28)📄 Description
ELI-5
When we bump a caller repo, it might pin our reusable workflow from more than one file. The current code commits those files one at a time (a separate API call per file). If the 3rd call fails after the 1st and 2nd already landed, the branch is left with a partial bump — and if an open PR points at that branch, someone could merge a half-done bump. This PR makes all of a repo's files land in one commit or none: we build the whole commit off to the side (blobs → tree → commit) and only then move the branch to it in a single step. A failure anywhere leaves the branch untouched.
What changed
bump_repo()Pass 2 no longer loopsPUT repos/<repo>/contents/<file>per file. Instead, for each staged file it:POST git/blobs— create a blob for the new content.POST git/trees— build one tree withbase_tree=MAIN_SHA(the resolved default-branch tip) carrying all staged blobs, so every other path in the repo is preserved and only the bumped files appear.POST git/commits— create one commit with that tree, parented onMAIN_SHA(clean "bump to @SHORT" diff vs the default branch).POST/PATCH git/refs/heads/<branch>— point the stable bump branch at the finished commit (create if new, else force). The ref moves in one step from its old state to the complete commit; it never transiently sits at an empty/partial tree.Because the commit is fully built before the ref moves, a failure at any step leaves only dangling (GC-able) blobs/tree/commit and the branch untouched — all-or-nothing. This closes the residual BE-3896 partial-bump window: a mid-sequence failure that previously left earlier files committed on the branch (and, if an open PR pointed at it, a partial-yet-mergeable bump).
Test changes
tests/test_bump_callers.sh— theghstub now models the Git Data API calls instead of the per-file Contents PUT:POST git/blobs→ captures each blob's decoded content (put.$n.txt/put.last.txt;count= number of blobs) — same content assertions as before.POST git/trees→ records the tree's path list asbranch_files(the atomic branch's final file set).POST git/commits→ returns a commit sha.POST/PATCH git/refs→ points the branch (no-op for file-set modeling).The BE-3896 monorepo assertion is preserved: both files still land on the one branch (now via one tree carrying both blobs). All 69 assertions pass;
shellcheck -xis clean.Verification
shellcheck -x .github/bump-callers/bump-callers.sh .github/bump-callers/tests/test_bump_callers.sh→ clean.bash .github/bump-callers/tests/test_bump_callers.sh→ 69 passed, 0 failed.Judgment calls
100644. Git tree entries need an explicit file mode; the bumped files are.github/workflows/*.ymlcallers, which are never executable, so100644is correct. (The old Contents PUT preserved mode implicitly; preserving it here would require an extra read of each existing tree entry's mode for no real-world benefit.)bump_repo()Pass 2's per-file PUT loop) only exists on PR #45's branch, not onmain.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.