You want to trigger a workflow only when a specific label 'deploy' is added to a pull request. Which configuration is correct?
Select an answer to reveal the explanation.
Short Explanation and Infographic
Use types: [labeled] to trigger on label events, then check github.event.label.name in an if: condition to filter for the specific label.
Full explanation below image
Full Explanation
The pull_request event has a 'types:' filter that includes 'labeled' (when any label is added). To filter for a specific label, combine 'types: [labeled]' with an 'if:' condition: 'if: github.event.label.name == "deploy"'. The 'on: pull_request: labels:' syntax doesn't exist — 'labels:' is not a valid filter under pull_request trigger (unlike 'branches:' and 'paths:'). 'pull_request_label' and 'label:' are not valid trigger names. The event payload 'github.event.label' contains the label that was just added, which you check in the if: condition.