workflows/backport: only trigger on backport labels

The backport job was previously triggered on any label activity, i.e.
when the backport label was already set and a new label added, the
backport would have been triggered again.

That's because github.event_name is actually "pull_request_target" in
this case, not "closed" or "labeled" (the event's types). Thus, this
part of the condition was always true.

This also means that the second part, the startsWith, was never
evaluated. It had its arguments flipped and would have always been
false.

This was introduced in #126825, but has never really worked as intended.

Resolves #199556
This commit is contained in:
Wolfgang Walther
2025-05-04 17:05:00 +02:00
parent 5c44d1cf95
commit b62d9a22fb
+1 -1
View File
@@ -14,7 +14,7 @@ permissions: {}
jobs:
backport:
name: Backport Pull Request
if: github.repository_owner == 'NixOS' && github.event.pull_request.merged == true && (github.event_name != 'labeled' || startsWith('backport', github.event.label.name))
if: github.repository_owner == 'NixOS' && github.event.pull_request.merged == true && (github.pull_request.action != 'labeled' || startsWith(github.event.label.name, 'backport'))
runs-on: ubuntu-24.04
steps:
# Use a GitHub App to create the PR so that CI gets triggered