Fix issue-labeler patterns to use portable cross-line matching#800
Conversation
Replace [\s\S]*? with (.|[\r\n])*? for matching across lines. The [\s\S] character class may not work in all regex engines, while (.|[\r\n]) is more portable. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the regex patterns in the issue-labeler configuration to use more portable cross-line matching syntax. The change replaces [\s\S]*? with (.|[\r\n])*? to ensure compatibility across different regex engines used by the github/issue-labeler action.
Changes:
- Updated all regex patterns to use
(.|[\r\n])*?instead of[\s\S]*?for cross-line matching - Updated comment to document the reasoning for the pattern choice
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - '## Type of change(.|[\r\n])*?- \[[xX]\]\s*[Bb]reaking [Cc]hange' | ||
| # Breaking change section with content after HTML comment | ||
| - '^[\s\S]*?# Breaking change[\s\S]*?-->\s*\n+[A-Z][a-z]+[\s\S]*?## Proposed change' | ||
| - '# Breaking change(.|[\r\n])*?-->\s*\n+[A-Z][a-z]+(.|[\r\n])*?## Proposed change' |
There was a problem hiding this comment.
The pattern # Breaking change matches any line containing '# Breaking change', not just a section header. This could produce false positives if that text appears elsewhere in the PR body. The pattern should be anchored or more specific to match the actual section structure from the PR template.
| - '# Breaking change(.|[\r\n])*?-->\s*\n+[A-Z][a-z]+(.|[\r\n])*?## Proposed change' | ||
| # Breaking change section with HTML comment removed | ||
| - '^[\s\S]*?# Breaking change\s*\n+[A-Z][a-z]+[\s\S]*?## Proposed change' | ||
| - '# Breaking change\s*\n+[A-Z][a-z]+(.|[\r\n])*?## Proposed change' |
There was a problem hiding this comment.
The pattern requires text starting with a capital letter followed by lowercase letters ([A-Z][a-z]+), but breaking change descriptions could start with various patterns (e.g., numbers, multiple capital letters, special characters). This is too restrictive and may miss valid breaking changes.
| - '# Breaking change(.|[\r\n])*?-->\s*\n+[A-Z][a-z]+(.|[\r\n])*?## Proposed change' | ||
| # Breaking change section with HTML comment removed | ||
| - '^[\s\S]*?# Breaking change\s*\n+[A-Z][a-z]+[\s\S]*?## Proposed change' | ||
| - '# Breaking change\s*\n+[A-Z][a-z]+(.|[\r\n])*?## Proposed change' |
There was a problem hiding this comment.
Both breaking-change patterns require content between the breaking change section and the 'Proposed change' section to start with [A-Z][a-z]+. According to the PR template, users are expected to remove the breaking change section if not applicable. These patterns may not correctly identify breaking changes if users provide different content formats or simply check the checkbox without filling in the breaking change section.
Proposed change
Replace
[\s\S]*?with(.|[\r\n])*?for matching across lines in issue-labeler patterns. The[\s\S]character class may not work in all regex engines, while(.|[\r\n])is more portable.This should fix the issue where checkbox patterns weren't matching PRs with breaking change checked.
Type of change
Additional information
🤖 Generated with Claude Code