@@ -234,9 +234,17 @@ jobs:
234234 const sectionRegex = new RegExp(`## ${sectionHeader}\\s*([\\s\\S]*?)(?=\\n## |$)`, 'i');
235235 const match = body.match(sectionRegex);
236236 if (!match) return true;
237- const content = match[1].trim();
238- // Empty if only whitespace, empty, or just an HTML comment
239- return !content || /^<!--.*-->$/.test(content);
237+ // Strip noise that doesn't count as user content:
238+ // - HTML comments (template placeholders)
239+ // - Reference-style link definitions added by Jira/GitHub integrations (e.g. [IM-123]: https://...)
240+ // - Horizontal rules and our own footer markers (from previous workflow runs)
241+ const content = match[1]
242+ .replace(/<!--[\s\S]*?-->/g, '')
243+ .replace(/^\[.+?\]:\s*\S.*$/gm, '')
244+ .replace(/^[-*]{3,}$/gm, '')
245+ .replace(/^_.*Auto-(generated|filled).*_$/gm, '')
246+ .trim();
247+ return !content;
240248 };
241249
242250 // Helper to check if any checkbox is checked in Type of Change
@@ -334,7 +342,7 @@ jobs:
334342 // Add footer if we changed anything
335343 const madeChanges = fillDescription || (fillTicket && ticketSection) || fillType || (fillTesting && testing);
336344 if (madeChanges && !newBody.includes('Auto-generated by Claude') && !newBody.includes('Auto-filled')) {
337- const footer = claudeSuccess ? '\n\n--- \n_✨ Auto-generated by Claude_' : '\n\n--- \n_📝 Auto-filled_';
345+ const footer = claudeSuccess ? '\n\n*** \n_✨ Auto-generated by Claude_' : '\n\n*** \n_📝 Auto-filled_';
338346 newBody = newBody.trim() + footer;
339347 }
340348
0 commit comments