From 50a102a0315e9ca5d6d90bf8b771e2df9ab62ff1 Mon Sep 17 00:00:00 2001 From: Marcelo Gobetti Date: Wed, 4 Mar 2026 15:33:45 -0300 Subject: [PATCH] Fix isSectionEmpty to ignore Jira reference links and previous footer - Strip reference-style link definitions (e.g. [IM-2611]: url added by Jira's GitHub integration) from section content before checking emptiness, so the last section (Testing Done) is not treated as filled just because Jira appended a link definition below it - Strip horizontal rules and our own footer text so a section that only received a footer (but no actual content) is retried on subsequent runs - Switch footer separator from --- to *** since GitHub drops --- when it follows HTML comment placeholders in certain contexts Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/auto-fill-pr.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/auto-fill-pr.yml b/.github/workflows/auto-fill-pr.yml index e8351bb..42e7b66 100644 --- a/.github/workflows/auto-fill-pr.yml +++ b/.github/workflows/auto-fill-pr.yml @@ -234,9 +234,17 @@ jobs: const sectionRegex = new RegExp(`## ${sectionHeader}\\s*([\\s\\S]*?)(?=\\n## |$)`, 'i'); const match = body.match(sectionRegex); if (!match) return true; - const content = match[1].trim(); - // Empty if only whitespace, empty, or just an HTML comment - return !content || /^$/.test(content); + // Strip noise that doesn't count as user content: + // - HTML comments (template placeholders) + // - Reference-style link definitions added by Jira/GitHub integrations (e.g. [IM-123]: https://...) + // - Horizontal rules and our own footer markers (from previous workflow runs) + const content = match[1] + .replace(//g, '') + .replace(/^\[.+?\]:\s*\S.*$/gm, '') + .replace(/^[-*]{3,}$/gm, '') + .replace(/^_.*Auto-(generated|filled).*_$/gm, '') + .trim(); + return !content; }; // Helper to check if any checkbox is checked in Type of Change @@ -334,7 +342,7 @@ jobs: // Add footer if we changed anything const madeChanges = fillDescription || (fillTicket && ticketSection) || fillType || (fillTesting && testing); if (madeChanges && !newBody.includes('Auto-generated by Claude') && !newBody.includes('Auto-filled')) { - const footer = claudeSuccess ? '\n\n---\n_✨ Auto-generated by Claude_' : '\n\n---\n_📝 Auto-filled_'; + const footer = claudeSuccess ? '\n\n***\n_✨ Auto-generated by Claude_' : '\n\n***\n_📝 Auto-filled_'; newBody = newBody.trim() + footer; }