Skip to content

Fix section detection and footer spacing in auto-fill-pr#20

Merged
gobetti merged 1 commit intomainfrom
fix/auto-fill-pr-section-detection
Mar 4, 2026
Merged

Fix section detection and footer spacing in auto-fill-pr#20
gobetti merged 1 commit intomainfrom
fix/auto-fill-pr-section-detection

Conversation

@gobetti
Copy link
Contributor

@gobetti gobetti commented Mar 4, 2026

Summary

  • Ticket not filled: isSectionEmpty used a hardcoded next-section name (e.g. 'Type of Change') to bound its regex. PR templates that use different section names (like ht-android's ## Prevent CI failures) caused the regex to capture everything to end-of-string, so the section was never considered empty and never filled. Fixed by using \n## as the boundary to match any next heading.
  • Ticket detection on workflow_call: Added fallback to github.ref (stripping refs/heads/) when github.head_ref is empty, so ticket detection works for both pull_request and workflow_call triggers.
  • Footer --- cramped against content: newBody.trim() removed trailing newlines before the footer was appended, leaving \n---\n with no blank line before the separator (which can even render as a setext <h2> in some Markdown parsers). Fixed by using \n\n---\n.

Test plan

  • Open a PR with a branch name containing IM-XXXX — Ticket section should be auto-filled
  • Open a PR using a template that doesn't have a ## Type of Change section — Ticket and Testing Done should still be detected and filled correctly
  • Verify the --- footer separator renders with a blank line above it, not directly adjacent to the last bullet point

🤖 Generated with Claude Code


📝 Auto-filled

- Fix isSectionEmpty to use \n## as boundary instead of a hardcoded next
  section name, so it works with any PR template regardless of section order
- Fix ticket detection to fall back to github.ref when github.head_ref is
  empty (workflow_call triggers)
- Add blank line before --- footer separator to prevent it rendering as a
  setext heading or appearing cramped against the last bullet point

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@gobetti gobetti merged commit 4e96f34 into main Mar 4, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants