Improve labeler patterns and fix duplicate workflow triggers#796
Merged
Conversation
Adds a second pattern to detect breaking changes when the "Breaking change" section in the PR template has actual content (text after the HTML comment and before "## Proposed change"). This complements the existing checkbox detection, since the PR template instructs users to fill in the breaking change section with details when applicable. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds a second pattern that matches when the HTML comment template is removed and content is added directly after the "# Breaking change" header. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Anchor patterns with ^ to prevent matching "# Breaking change" text that appears inside code blocks or elsewhere in the PR body. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to enhance breaking change detection in PR body content by adding regex patterns to identify when users fill in the "Breaking change" section of the PR template with actual content, complementing the existing checkbox-based detection.
Changes:
- Added two new regex patterns to detect breaking changes based on PR template content
- Added explanatory comments for the new patterns
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Changes: - Use \n# instead of ^ to require newline immediately before # (indented code blocks have spaces between newline and #) - Require content to start with capitalized word + space ([A-Z][a-z]+\s) to match natural language, not regex patterns - Require ## Proposed change at line start too Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Key insight: require ## Proposed change to appear AFTER the match. Since ## Proposed change only appears once, any # Breaking change in code blocks after it won't match (no ## Proposed change follows). Pattern logic: - ^[\s\S]*? finds FIRST # Breaking change (non-greedy from start) - Requires content (capitalized word after header/comment) - [\s\S]*?## Proposed change requires this header to follow Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The checkbox in the PR template is "- [x] Breaking change". Requiring the "- " prefix prevents matching inline code examples like `[x] Breaking change` in PR descriptions. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Changes: - Remove pull_request trigger (was causing duplicate runs with pull_request_target) - Keep only pull_request_target for PR events (provides write permissions for fork PRs) - Update auto-merge condition to check for pull_request_target - Consolidate activity types to single line The warnings about pull_request_target activity types are from an outdated linter schema - the types are valid per GitHub's current documentation. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
All checkbox patterns now require the "## Type of change" header to appear first, preventing matches on checkbox examples elsewhere in the PR body (like in code blocks or descriptions). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed change
Breaking change label detection - Adds regex patterns to detect when the "# Breaking change" section contains actual content (in addition to the existing checkbox detection)
Fix duplicate workflow runs - Removes redundant
pull_requesttrigger from repository.yaml, keeping onlypull_request_targetwhich provides write permissions needed for fork PRsBreaking change pattern design:
^[\s\S]*?to find FIRST# Breaking changefrom body start[A-Z][a-z]+) for natural language## Proposed changeto appear AFTER - this ignores any mentions in code blocks since there's only one## Proposed changein the body-prefix to avoid matching inline code examplesWorkflow fix:
pull_request+pull_request_targetwith same activity types caused duplicate runspull_request_targetwhich works for both fork and non-fork PRspull_request_targetType of change
Additional information
🤖 Generated with Claude Code