Skip to content

Commit 5a5e4af

Browse files
Fold breaking-change labeling into label-pr workflow
Move the title -> 'breaking change' label logic into the existing label-pr workflow (which already applies the python/.NET labels) and drop the separate label-breaking-change workflow. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent b14d5b9 commit 5a5e4af

2 files changed

Lines changed: 23 additions & 36 deletions

File tree

.github/workflows/label-breaking-change.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

.github/workflows/label-pr.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,26 @@ jobs:
1919
- uses: actions/labeler@f27b608878404679385c85cfa523b85ccb86e213 # v6
2020
with:
2121
repo-token: "${{ secrets.GH_ACTIONS_PR_WRITE }}"
22+
23+
- name: "PR: add breaking change label from title"
24+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
25+
with:
26+
github-token: ${{ secrets.GH_ACTIONS_PR_WRITE }}
27+
script: |
28+
const breakingLabel = "breaking change";
29+
const title = context.payload.pull_request.title || "";
30+
31+
// Add the label when the title contains the "[BREAKING]" prefix.
32+
// The label-title-prefix workflow handles the reverse direction
33+
// (adding the "[BREAKING]" prefix when the label is applied).
34+
if (/\[BREAKING\]/i.test(title)) {
35+
const labels = context.payload.pull_request.labels.map(l => l.name);
36+
if (!labels.includes(breakingLabel)) {
37+
await github.rest.issues.addLabels({
38+
issue_number: context.issue.number,
39+
owner: context.repo.owner,
40+
repo: context.repo.repo,
41+
labels: [breakingLabel]
42+
});
43+
}
44+
}

0 commit comments

Comments
 (0)