Two compounding issues caused merging a backport PR to spawn another
backport (e.g. #2581 [Backport release-1.2] [Backport release-1.3] ...
from #2579):
1. pr-labeler auto-added the `backport` label to any PR whose title
started with `[Backport release-X.Y]` (regression introduced in
c8ed1c65 when pr-labeler.yaml was first added). korthout/backport-
action puts that prefix on every backport PR it creates, so the
label was being re-applied to every backport, satisfying the
workflow's gate when the backport itself was merged.
2. Even with that fixed, an external labeling bot (dosubot) still
re-applies `backport-previous` to backport PRs based on similarity
to the parent. That bot is configured at the org level and cannot
be controlled from this repo.
Drop the `toAdd.add('backport')` line from pr-labeler so the label
isn't propagated by us, and gate both backport jobs on
`pull_request.base.ref == 'main'` so backport PRs (which target
release-X.Y) cannot trigger the workflow regardless of what labels
end up on them.
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>