Skip to content

Conversation

@raman325
Copy link
Owner

@raman325 raman325 commented Jan 15, 2026

Proposed change

Fix the breaking-change label pattern in issue-labeler.yml to use regex alternation (OR logic) instead of separate array items (AND logic).

The Problem

The github/issue-labeler action requires ALL patterns in an array to match for a label to be applied. Our previous config had three separate patterns:

breaking-change:
  - '- \[x\] Breaking change'
  - '- \[X\] Breaking change'
  - '# Breaking change\n\n[A-Z]'

These patterns are mutually exclusive (lowercase [x] vs uppercase [X]), so the label was never applied.

The Solution

Use regex alternation (|) within a single pattern for OR logic:

breaking-change:
  - '## Type of change(.|[\r\n])*?- \[[xX]\]\s*Breaking change|# Breaking change\n\n[A-Z]'

This matches either:

  1. A checked Breaking change checkbox after the "Type of change" header
  2. A "# Breaking change" section with actual content (starts with capital letter)

Testing

Verified with Node.js that the pattern correctly:

  • Matches PR bodies with checked Breaking change checkbox ✓
  • Matches PR bodies with Breaking change section content ✓
  • Does NOT match PR bodies without breaking changes ✓

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (which adds functionality)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: Fixes the breaking-change auto-labeler that wasn't working
  • This PR is related to issue: N/A

🤖 Generated with Claude Code

The github/issue-labeler action requires ALL patterns in an array to
match (AND logic). Our previous config had three separate patterns that
were mutually exclusive, so the label was never applied.

Changed to use regex alternation (|) within a single pattern for OR
logic: match either the checked checkbox OR a section with content.

Also added a comment documenting this AND vs OR behavior to prevent
future confusion.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings January 15, 2026 18:21
@github-actions github-actions bot added the bug Something isn't working label Jan 15, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a critical bug in the breaking-change label auto-detection pattern. The previous configuration used AND logic (multiple array items) for mutually exclusive patterns, preventing the label from ever being applied. The fix correctly uses regex alternation (OR logic) within a single pattern.

Changes:

  • Replaced three mutually exclusive patterns with a single pattern using regex alternation (|) for OR logic
  • Added documentation explaining AND vs OR logic behavior in the issue-labeler configuration
  • Updated the breaking-change pattern to match the same structure as other label patterns (starting with "## Type of change")

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

raman325 and others added 4 commits January 15, 2026 13:41
- Use case-insensitive character classes [Bb]reaking [Cc]hange for
  consistency with other patterns
- Add whitespace flexibility to section header pattern to handle
  Windows line endings and extra spaces

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The pattern now skips over the optional HTML comment from the PR
template, so copy-pasting the template without adding content won't
trigger the breaking-change label. Only actual content after the
header (or after the comment) will match.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Use YAML >- (folded block scalar) to write regex across multiple lines
  that map to the document structure
- Add detailed comments explaining each part of the regex pattern
- Pattern breakdown shows how it matches PR template sections
- Line breaks become spaces, making the regex easier to understand

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Previously only matched .github/workflows/**, now matches all files
under .github/ including labeler configs, templates, etc.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Better reflects the broader scope - now covers all .github/ files
(workflows, labeler configs, templates, etc.) not just actions.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@raman325 raman325 added github-config Changes to .github/ configuration files and removed github_actions labels Jan 15, 2026
@raman325 raman325 merged commit 3a99b60 into main Jan 15, 2026
26 checks passed
@raman325 raman325 deleted the fix/issue-labeler-or-logic branch January 15, 2026 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working github-config Changes to .github/ configuration files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants