From 64f1243bdfe32ffa468362bc8a63c7ab361b1762 Mon Sep 17 00:00:00 2001 From: Michael Jolley Date: Thu, 25 Jun 2026 14:22:58 -0500 Subject: [PATCH] Skip auto-labeling PRs that already have labels (#48877) ## Summary The auto-labeler workflow now skips pull requests that already have labels applied before running the AI classification. This avoids overwriting or duplicating labels that were manually set by contributors or maintainers. ## Changes - Added a check in `labelIssue()` that returns early for PRs with existing labels, logging which labels are already present. - Issues continue to be labeled regardless (only PRs get the skip logic). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/workflows/auto-labeler.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/auto-labeler.yml b/.github/workflows/auto-labeler.yml index f568df9013..111675babe 100644 --- a/.github/workflows/auto-labeler.yml +++ b/.github/workflows/auto-labeler.yml @@ -73,6 +73,13 @@ jobs: const itemType = issue.pull_request ? 'Pull request' : 'Issue'; + // Skip pull requests that already have labels applied. + if (issue.pull_request && issue.labels && issue.labels.length > 0) { + const existingLabels = issue.labels.map(l => l.name).join(', '); + console.log(`${itemType} #${issueNumber} already has labels (${existingLabels}); skipping.`); + return; + } + const title = issue.title ?? ''; const body = issue.body ?? '';