Fix section detection and footer spacing in auto-fill-pr#20
Merged
Conversation
- 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>
LandonS23
approved these changes
Mar 4, 2026
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.
Summary
isSectionEmptyused 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.workflow_call: Added fallback togithub.ref(strippingrefs/heads/) whengithub.head_refis empty, so ticket detection works for bothpull_requestandworkflow_calltriggers.---cramped against content:newBody.trim()removed trailing newlines before the footer was appended, leaving\n---\nwith 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
IM-XXXX— Ticket section should be auto-filled## Type of Changesection — Ticket and Testing Done should still be detected and filled correctly---footer separator renders with a blank line above it, not directly adjacent to the last bullet point🤖 Generated with Claude Code
📝 Auto-filled