feat(scripts): add foreman-finalize.sh post-GO branch finalizer#1126
Merged
Conversation
Rebase a GO'd Foreman agentic-coding branch onto current base by re-applying its source changes and regenerating derived artifacts (never copying the branch's possibly-stale generated files), drift-check the regen, squash to one commit with an issue-derived conventional-commit subject, and open the PR. Full-auto to PR with hard stops (dirty tree, source/base overlap, non-idempotent codegen, build/vet/validate-samples failure, missing sign-off). --dry-run previews without touching GitHub. Remotes/repo/fork-owner are parameterized. Motivated by finalizing defilantech#1098 by hand: a branchStrategy=reset revise produced a single commit mislabeled fix-vs-feat, and its stale generated deepcopy reverted another merged PR's methods. Signed-off-by: Christopher Maher <chris@mahercode.io>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
scripts/foreman-finalize.sh: one command that turns a GO'd Foreman agentic-coding branch into a clean, single-commit PR against the base repo.Why
A Foreman
branchStrategy: resetrevise commits the whole tree as a single commit whose message reflects only the last fix (so a feature gets labeledfix, misfiling the release-please changelog), and its base can lag the real base so its generated files (zz_generateddeepcopy, CRDs) are stale and clobber already-merged work. Finalizing by hand is repetitive and error-prone; this codifies the safe steps.How
Mechanic: re-apply the branch's source changes onto current base and regenerate derived artifacts, rather than copying the branch's possibly-stale generated files. Flow:
ghauth, fetch base + fork branch, read the issue.[FEATURE]→feat,[BUG]→fix; scope from acomponent/*label):type(scope): <title> (#N).finalize/<issue>-<slug>branch off base;make manifests generate chart-crds.go build,go vet,make validate-samples(--full-testaddsmake test).Signed-off-byasserted.--dry-runprints the commands + message instead).Remotes/repo/fork-owner are parameterized (defaults:
upstream/mainbase,originfork). Hard stops leave the branch intact for inspection.Testing
shellcheckclean;bash -nparses.--dry-runagainst a GO'd Foreman branch correctly hit the overlap guard (its feature had already merged), and against a synthetic branch based on currentmainran the full happy path (assemble → regen → idempotency → build/vet/validate-samples → DCO commit → printed push +gh pr create+ message/body) and cleanly restored the original branch. No mock-git harness (out of scope for v1).Checklist
shellcheckclean--dry-runexercised (overlap-guard path and happy path)AI assistance
Designed and implemented with AI assistance (Claude Code); reviewed and owned by the author. Band-3 disclosure per the project's AI-assisted contribution policy.