GH-200 · Question #55
Which GitHub Actions event configuration triggers only for pull requests targeting the release branch and not for push events?
The correct answer is B. on: pull_request: branches: - release. The pull_request event with a branches filter set to release triggers the workflow only when a pull request targets the release branch-not on direct pushes. Option A (pull_request_target) also filters by branch but runs in the context of the base branch and has different…
Question
Which GitHub Actions event configuration triggers only for pull requests targeting the release branch and not for push events?
Options
- Aon: pull_request_target: branches: - release
- Bon: pull_request: branches: - release
- Con: push: branches: - release
- Don: pull_request: types: - opened
How the community answered
(39 responses)- A5% (2)
- B92% (36)
- C3% (1)
Explanation
The pull_request event with a branches filter set to release triggers the workflow only when a pull request targets the release branch-not on direct pushes. Option A (pull_request_target) also filters by branch but runs in the context of the base branch and has different security implications. Option C (push) triggers on direct commits pushed to the branch, not pull requests. Option D triggers on pull_request but only for the opened type without a branch filter, so it would apply to all branches.
Topics
Community Discussion
No community discussion yet for this question.