Dispatch workflows push directly to main — races with concurrent human commits #7
Labels
No labels
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
queue
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
romaine-life/pipeline-templates#7
Loading…
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?
Problem
The `go-dependency-update-template` and `release-and-dispatch-template` push directly to `main` when they bump go.mod and cut releases. When a human is also pushing to the same branch around the same time, the human's push gets rejected and they have to stash → pull --rebase → resolve go.mod/go.sum conflicts → push. Every cascade iteration.
Real example from today: pushed a tui.go change to fzt-terminal. The dep-update bot had just pushed a go.mod bump. My push was rejected. Had to:
Same dance happened again on fzt-automate immediately after. The friction is predictable, reproducible, and scales with the number of cascading repos — right now that's 5 repos per full cascade, meaning 5 chances per cascade for a race.
Design options
1. Bot uses PRs instead of direct pushes to main (recommended)
Bot creates a branch (e.g. `auto/deps-$(date +%s)`), commits the bump there, opens a PR, auto-merges when CI passes. Human commits still go to main directly. No race — the bot's work lives on a side branch until it's ready to merge, and the merge itself is atomic against whatever is on main at merge time.
Pros: No races. PR history is auditable. Auto-merge handles the atomic land.
Cons: ~30s latency per hop (branch → PR → merge). Auto-merge needs to be enabled at repo level. Need to handle the edge case where auto-merge can't apply because main drifted.
2. Bot holds a lock / serialized concurrency (narrower)
Already using GitHub Actions concurrency groups — extend to include human-initiated workflows. Doesn't help with human `git push` directly from terminal though, only workflow-to-workflow races.
3. Human-side retry wrapper
A shell helper that wraps `git push` with `pull --rebase` retry + auto-resolve on go.mod/go.sum conflicts (taking the newer version). Unblocks push friction but doesn't fix the underlying race.
Recommendation
Option 1. The templates already know how to mint installation tokens via the `romaine-life-app` GitHub App; creating a PR via `gh pr create` with that token is a one-step addition. Auto-merge needs to be enabled per repo, but can be in the same PR that ships this template change.
Happy to prototype the template change against one repo (fzt-frontend?) to validate before rolling out.