From d2041259aa15fdb93974afdfd6dd77e49be0ee1d Mon Sep 17 00:00:00 2001 From: raman325 <7243222+raman325@users.noreply.github.com> Date: Thu, 15 Jan 2026 02:50:51 -0500 Subject: [PATCH 1/8] Add breaking change label detection from PR body section 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 --- .github/issue-labeler.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/issue-labeler.yml b/.github/issue-labeler.yml index 5a685d6d4..b4195565c 100644 --- a/.github/issue-labeler.yml +++ b/.github/issue-labeler.yml @@ -11,6 +11,8 @@ enhancement: breaking-change: - '\[[xX]\]\s*[Bb]reaking [Cc]hange' + # Match when breaking change section has content after the HTML comment + - '-->\s*\n+[A-Za-z][\s\S]*?## Proposed change' code-quality: - '\[[xX]\]\s*[Cc]ode [Qq]uality' From a7866a7ceb55c686b7455fa2d1f3880a7da57f03 Mon Sep 17 00:00:00 2001 From: raman325 <7243222+raman325@users.noreply.github.com> Date: Thu, 15 Jan 2026 02:51:27 -0500 Subject: [PATCH 2/8] Handle case where HTML comment is removed from breaking change section 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 --- .github/issue-labeler.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/issue-labeler.yml b/.github/issue-labeler.yml index b4195565c..4a0166539 100644 --- a/.github/issue-labeler.yml +++ b/.github/issue-labeler.yml @@ -13,6 +13,8 @@ breaking-change: - '\[[xX]\]\s*[Bb]reaking [Cc]hange' # Match when breaking change section has content after the HTML comment - '-->\s*\n+[A-Za-z][\s\S]*?## Proposed change' + # Match when HTML comment is removed and content is added directly + - '# Breaking change\s*\n+[A-Za-z][\s\S]*?## Proposed change' code-quality: - '\[[xX]\]\s*[Cc]ode [Qq]uality' From 65c078a6be981905f9e3b4da25dbdff31187bf07 Mon Sep 17 00:00:00 2001 From: raman325 <7243222+raman325@users.noreply.github.com> Date: Thu, 15 Jan 2026 02:52:42 -0500 Subject: [PATCH 3/8] Fix breaking change pattern to only match at body start 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 --- .github/issue-labeler.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/issue-labeler.yml b/.github/issue-labeler.yml index 4a0166539..b49550f9d 100644 --- a/.github/issue-labeler.yml +++ b/.github/issue-labeler.yml @@ -11,10 +11,10 @@ enhancement: breaking-change: - '\[[xX]\]\s*[Bb]reaking [Cc]hange' - # Match when breaking change section has content after the HTML comment - - '-->\s*\n+[A-Za-z][\s\S]*?## Proposed change' - # Match when HTML comment is removed and content is added directly - - '# Breaking change\s*\n+[A-Za-z][\s\S]*?## Proposed change' + # Match when breaking change section (at start of body) has content after HTML comment + - '^# Breaking change[\s\S]*?-->\s*\n+[A-Za-z][\s\S]*?## Proposed change' + # Match when HTML comment is removed and content added directly (must be at body start) + - '^# Breaking change\s*\n+[A-Za-z][\s\S]*?## Proposed change' code-quality: - '\[[xX]\]\s*[Cc]ode [Qq]uality' From 2fc40980edbfaf95787192d5a2f56ed8c636155e Mon Sep 17 00:00:00 2001 From: raman325 <7243222+raman325@users.noreply.github.com> Date: Thu, 15 Jan 2026 02:54:08 -0500 Subject: [PATCH 4/8] Fix breaking change pattern to avoid matching code blocks 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 --- .github/issue-labeler.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/issue-labeler.yml b/.github/issue-labeler.yml index b49550f9d..66d64a223 100644 --- a/.github/issue-labeler.yml +++ b/.github/issue-labeler.yml @@ -11,10 +11,11 @@ enhancement: breaking-change: - '\[[xX]\]\s*[Bb]reaking [Cc]hange' - # Match when breaking change section (at start of body) has content after HTML comment - - '^# Breaking change[\s\S]*?-->\s*\n+[A-Za-z][\s\S]*?## Proposed change' - # Match when HTML comment is removed and content added directly (must be at body start) - - '^# Breaking change\s*\n+[A-Za-z][\s\S]*?## Proposed change' + # Match breaking change section with content after HTML comment + # Requires: header at line start, content starts with capitalized word (natural language) + - '\n# Breaking change[\s\S]*?-->\s*\n+[A-Z][a-z]+\s[\s\S]*?\n## Proposed change' + # Match when HTML comment is removed and content added directly + - '\n# Breaking change\s*\n+[A-Z][a-z]+\s[\s\S]*?\n## Proposed change' code-quality: - '\[[xX]\]\s*[Cc]ode [Qq]uality' From 3c93efaa904aaa7dd772de4d51a394dc020fcc32 Mon Sep 17 00:00:00 2001 From: raman325 <7243222+raman325@users.noreply.github.com> Date: Thu, 15 Jan 2026 03:00:12 -0500 Subject: [PATCH 5/8] Simplify breaking change pattern using document structure 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 --- .github/issue-labeler.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/issue-labeler.yml b/.github/issue-labeler.yml index 66d64a223..f31be0939 100644 --- a/.github/issue-labeler.yml +++ b/.github/issue-labeler.yml @@ -11,11 +11,12 @@ enhancement: breaking-change: - '\[[xX]\]\s*[Bb]reaking [Cc]hange' - # Match breaking change section with content after HTML comment - # Requires: header at line start, content starts with capitalized word (natural language) - - '\n# Breaking change[\s\S]*?-->\s*\n+[A-Z][a-z]+\s[\s\S]*?\n## Proposed change' + # Match breaking change section with content after HTML comment. + # Uses ^[\s\S]*? to find FIRST # Breaking change, requires ## Proposed change AFTER. + # This ignores any # Breaking change in code blocks after ## Proposed change. + - '^[\s\S]*?# Breaking change[\s\S]*?-->\s*\n+[A-Z][a-z]+[\s\S]*?## Proposed change' # Match when HTML comment is removed and content added directly - - '\n# Breaking change\s*\n+[A-Z][a-z]+\s[\s\S]*?\n## Proposed change' + - '^[\s\S]*?# Breaking change\s*\n+[A-Z][a-z]+[\s\S]*?## Proposed change' code-quality: - '\[[xX]\]\s*[Cc]ode [Qq]uality' From 564d4f26f51ddec91a6301d77104895a673b55fd Mon Sep 17 00:00:00 2001 From: raman325 <7243222+raman325@users.noreply.github.com> Date: Thu, 15 Jan 2026 12:22:04 -0500 Subject: [PATCH 6/8] Require - prefix for breaking change checkbox pattern 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 --- .github/issue-labeler.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/issue-labeler.yml b/.github/issue-labeler.yml index f31be0939..af25c1ac9 100644 --- a/.github/issue-labeler.yml +++ b/.github/issue-labeler.yml @@ -10,7 +10,8 @@ enhancement: - '\[[xX]\]\s*[Nn]ew [Ff]eature' breaking-change: - - '\[[xX]\]\s*[Bb]reaking [Cc]hange' + # Checkbox pattern - requires "- " prefix to avoid matching inline code examples + - '- \[[xX]\]\s*[Bb]reaking [Cc]hange' # Match breaking change section with content after HTML comment. # Uses ^[\s\S]*? to find FIRST # Breaking change, requires ## Proposed change AFTER. # This ignores any # Breaking change in code blocks after ## Proposed change. From b23d62de80162aa59115233452615da0cfdfc6d0 Mon Sep 17 00:00:00 2001 From: raman325 <7243222+raman325@users.noreply.github.com> Date: Thu, 15 Jan 2026 12:30:08 -0500 Subject: [PATCH 7/8] Remove duplicate pull_request trigger, use only pull_request_target 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 --- .github/workflows/repository.yaml | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/.github/workflows/repository.yaml b/.github/workflows/repository.yaml index aa8a85034..78f1bddd5 100644 --- a/.github/workflows/repository.yaml +++ b/.github/workflows/repository.yaml @@ -5,24 +5,11 @@ name: Repository on: push: branches: [main] - pull_request: - types: - - edited - - labeled - - opened - - reopened - - synchronize - - unlabeled - # pull_request_target is needed for fork PRs - it runs in the base repo context - # with elevated permissions required for pull-requests: write + # pull_request_target runs in base repo context with write permissions, + # needed for fork PRs. Safe for auto-merge since it only runs for trusted + # actors (dependabot, pre-commit-ci, or manually labeled PRs). pull_request_target: - types: - - edited - - labeled - - opened - - reopened - - synchronize - - unlabeled + types: [edited, labeled, opened, reopened, synchronize, unlabeled] workflow_dispatch: permissions: @@ -54,10 +41,10 @@ jobs: auto-merge: name: Auto Merge runs-on: ubuntu-latest - # Only run on pull_request events (not push, pull_request_target, or workflow_dispatch) + # Only run on pull_request_target events (not push or workflow_dispatch) # and only for dependabot, pre-commit-ci, or PRs with auto-merge label if: >- - github.event_name == 'pull_request' && ( + github.event_name == 'pull_request_target' && ( github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.user.login == 'pre-commit-ci[bot]' || contains(github.event.pull_request.labels.*.name, 'auto-merge') From bfb6abea19de58bbdbd6c5e74cca5079ffe33883 Mon Sep 17 00:00:00 2001 From: raman325 <7243222+raman325@users.noreply.github.com> Date: Thu, 15 Jan 2026 12:35:02 -0500 Subject: [PATCH 8/8] Require ## Type of change header before checkbox patterns 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 --- .github/issue-labeler.yml | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/issue-labeler.yml b/.github/issue-labeler.yml index af25c1ac9..44e1c951c 100644 --- a/.github/issue-labeler.yml +++ b/.github/issue-labeler.yml @@ -1,23 +1,21 @@ # Configuration for github/issue-labeler - body-based labels # See: https://github.com/github/issue-labeler # Uses regex patterns to match PR/issue body content -# Note: [xX] matches both lowercase and uppercase X in checkboxes +# All checkbox patterns require ## Type of change header first to avoid matching examples --- bug: - - '\[[xX]\]\s*[Bb]ugfix' + - '## Type of change[\s\S]*?- \[[xX]\]\s*[Bb]ugfix' enhancement: - - '\[[xX]\]\s*[Nn]ew [Ff]eature' + - '## Type of change[\s\S]*?- \[[xX]\]\s*[Nn]ew [Ff]eature' breaking-change: - # Checkbox pattern - requires "- " prefix to avoid matching inline code examples - - '- \[[xX]\]\s*[Bb]reaking [Cc]hange' - # Match breaking change section with content after HTML comment. - # Uses ^[\s\S]*? to find FIRST # Breaking change, requires ## Proposed change AFTER. - # This ignores any # Breaking change in code blocks after ## Proposed change. + # Checkbox in Type of change section + - '## Type of change[\s\S]*?- \[[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' - # Match when HTML comment is removed and content added directly + # Breaking change section with HTML comment removed - '^[\s\S]*?# Breaking change\s*\n+[A-Z][a-z]+[\s\S]*?## Proposed change' code-quality: - - '\[[xX]\]\s*[Cc]ode [Qq]uality' + - '## Type of change[\s\S]*?- \[[xX]\]\s*[Cc]ode [Qq]uality'