workflows: fix invalid usage of github.event_name

The condition was wrong because `github.event_name` will never be
`labeled` since this field always refers to the actual type of the
event, which in this case will always be `pull_request`. We need to
determine which type of activity has triggered the workflow via the
`github.event.action` context.
This commit is contained in:
Yonas Habteab 2025-11-28 09:18:14 +01:00
parent 519da9cf75
commit 551a0f6fae

View file

@ -11,7 +11,12 @@ permissions: {}
jobs:
backbot:
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'Icinga' && github.event.pull_request.merged == true && (github.event_name != 'labeled' || startsWith(github.event.label.name, 'backport-to-support/')) }}
if: |
github.repository_owner == 'Icinga' &&
github.event.pull_request.merged == true && (
github.event.action != 'labeled' ||
startsWith(github.event.label.name, 'backport-to-support/')
)
steps:
- name: Generate GitHub Installation Access Token
# Use GitHub App to generate an installation access token to allow PRs created by Backbot to trigger workflows.