chore: squash-merge commit body from ## Description only - #825
chore: squash-merge commit body from ## Description only#825nekomoto911 wants to merge 1 commit into
Conversation
GitHub cannot natively use only the Description section of a templated PR body. Document that convention, add extract/merge helpers, and leave repo squash message default blank so UI merges do not dump the checklist.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8101b81986
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| printf '%s' "$desc" | ||
| echo "-----------------" | ||
|
|
||
| gh pr merge "$pr" "${repo_args[@]}" --squash --subject "$title" --body "$desc" "${extra[@]}" |
There was a problem hiding this comment.
Pin the PR head before invoking the merge
When this helper is run with the advertised --admin option—or with rules that do not invalidate approval after a push—a contributor can update the PR after the body/title reads on lines 49–50 but before this command executes. gh pr merge then merges the PR's new head while the operator sees metadata fetched from the earlier state, potentially admitting unreviewed code. gh pr merge --help documents --match-head-commit SHA as requiring the PR head to match that SHA; fetch headRefOid with the metadata and pass that option. This can be validated by pausing a mocked second gh pr view, changing the head, and observing that the current invocation contains no expected SHA.
AGENTS.md reference: AGENTS.md:L5-L12
Useful? React with 👍 / 👎.
| nxt = re.search(r"(?m)^##\s+\S", rest) | ||
| section = rest[: nxt.start()] if nxt else rest |
There was a problem hiding this comment.
Ignore fenced-code contents when locating the next heading
For a Description containing a fenced Markdown example with a line such as ## Example, this regex treats that line as the next section heading even though Markdown renders it as code. The extractor consequently truncates the commit body—potentially in the middle of an open fence—and drops all subsequent Description text. A minimal body of ## Description, before, an opening fence, ## Example, a closing fence, after, and then the real next H2 reproduces output containing only before and the opening fence; heading detection needs to account for fenced blocks.
AGENTS.md reference: AGENTS.md:L6-L12
Useful? React with 👍 / 👎.
|
Clarification on squash defaults vs the helper scripts: GitHub web UI can only prefill Extended description as the entire PR body (
UI workflow: edit the prefilled body down to Description before confirming. |
Description
GitHub squash defaults can only use the whole PR body, not a subsection. Make
## Descriptionthe squash-commit body by convention, and add helpers to extract/merge with that section only.PULL_REQUEST_TEMPLATE.mdscripts/pr-description.sh— print## Descriptionuntil the next##scripts/pr-squash-merge.sh—gh pr merge --squashwith PR title + DescriptionPR_TITLE, message=BLANK(avoid dumping checklists into main)Usage:
scripts/pr-squash-merge.sh <pr>(or paste Description in the UI).Issue Number: n/a
How Has This Been Tested?
scripts/pr-description.sh 824 --repo Galxe/gravity-sdkreturns only the Description sectionType of Change
Checklist