Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Sep 4, 2025

Issue

The PR formatting check workflow was incorrectly allowing PRs with just the PR template (no meaningful content) to pass validation. This happened because:

  1. The PR template contains an unclosed HTML comment <!-- in the Summary section that starts a long comment block
  2. The validation logic only removed complete HTML comments (<!--...-->) using the regex /<!--[\s\S]*?-->/g
  3. The unclosed <!-- remained in the content and was counted toward the minimum 10-character requirement
  4. Even very short summaries like "Short" would pass validation because "Short\n\n\n<!--" has 12 characters

Root Cause

In the PR template, after the Summary section there's an unclosed HTML comment:

### Summary   
<!-- Insert your summary of changes below. Minimum 10 characters required. -->  


<!-- 
### PR Title Guide
...

The regex /<!--[\s\S]*?-->/g matches only the first complete comment but leaves the unclosed <!-- which gets counted as meaningful content.

Fix

Updated the HTML comment removal regex from:

summaryContent.replace(/<!--[\s\S]*?-->/g, '');

To:

summaryContent.replace(/<!--[\s\S]*?(?:-->|$)/g, '');

This pattern removes both:

  • Complete HTML comments: <!-- comment -->
  • Unclosed HTML comments at end of content: <!-- comment

Testing

Validated the fix with multiple scenarios:

  • ✅ Empty template now correctly fails validation
  • ✅ Template with short summary (< 10 chars) now correctly fails validation
  • ✅ Template with valid summary (≥ 10 meaningful chars) still passes validation
  • ✅ Fully compliant PRs continue to pass validation

This ensures PRs must have genuinely meaningful summaries rather than just template placeholders.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: bewithgaurav <8655500+bewithgaurav@users.noreply.github.com>
Copilot AI changed the title [WIP] my PR formatting check in workflows is setting green for any PRs which has just the PR Template Can you point out why is it doing it? FIX: PR formatting check incorrectly passes for templates with unclosed HTML comments Sep 4, 2025
Copilot AI requested a review from bewithgaurav September 4, 2025 10:10
Copilot finished work on behalf of bewithgaurav September 4, 2025 10:10
@bewithgaurav
Copy link
Collaborator

closing this since its a very minor fix, added it inside #186

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