Repository navigation
Description
Problem
github_merge_pr (write_tools.py, ~L287–330) builds gh pr merge <n> --repo <r> --<method> [--delete-branch] and offers no way to set the merge commit's subject or body. If the PR has a single commit, GitHub's squash uses that commit's subject, not the PR title. So correcting the PR title before merging doesn't stop a bad subject from landing on main, and there's no way to fix it inside the tool.
Evidence: design-system-plugin#48
- The PR title was corrected to
chore: release v0.16.0before merge. - The single-commit squash still landed on main as
feat: chore: release v0.16.0 (#48)(main4a779cb). - The release workflow keys on a
chore: release v…subject, so release run 39870343120 was skipped. - We recovered by hand with
workflow_dispatch(run 39870464197).
The bad feat: prefix comes from projectBoard-plugin#566 / #567, which add a conventional prefix to a title that already has one. Fixing that removes this particular cause. This issue is about the tool: it is still the only in-tool way to correct a bad squash subject before it reaches main, whatever the cause.
Proposed direction
- Add optional
subject: str = ""andbody: str = ""params togithub_merge_pr. - When non-empty, append
--subject <subject>/--body <body>to thegh pr mergeargs. These are gh's existing flags;--body-fileisn't needed. - Allow them for
squashandmerge. Forrebase, refuse with a clear error, since gh/GitHub ignore a subject on rebase merges and the call would otherwise appear to succeed. - Include them in the
dry_runpreview, e.g.… via squash with subject "chore: release v0.16.0 (#48)", so the operator can confirm the exact subject beforeconfirm=true. - Optionally add them to the
pr.mergedevent payload. - Update the docstring to say that a single-commit squash uses the commit subject, not the PR title, unless
subjectis set.
Acceptance
github_merge_pr(number=N, method="squash", subject="chore: release vX.Y.Z (#N)", confirm=True)runsgh pr merge N --repo R --squash --subject "chore: release vX.Y.Z (#N)".bodymaps to--bodyin the same way. Empty values add no flags, so current behaviour is unchanged.method="rebase"with a non-emptysubjectorbodyreturns anError:and does not run gh.- The dry-run output shows the subject/body when set.
- Unit tests cover the arg construction for all of the above.
Refs: projectBoard-plugin#566, projectBoard-plugin#567, design-system-plugin#48
Activity