AZ-400 Configure processes and communications Practice Question
A developer wants to automatically trigger a GitHub Actions workflow when a pull request is opened that targets the 'release' branch. Which trigger should they use?
⚠ Common exam trap
The trap is confusing `pull_request` with `push` or `pull_request_target`. `push` only fires when code is pushed, not when a PR is opened. `pull_request_target` does fire on PR activity, but it is designed for fork-safe workflows requiring secrets/write permissions; using it without that context is unnecessary and potentially unsafe. The question asks for a trigger when a PR is opened targeting a branch, so `pull_request` is the appropriate choice.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
pull_request: branches: [release]
The `pull_request` trigger fires when a pull request is opened, and the `branches: [release]` filter restricts it to PRs targeting the `release` branch. `pull_request_target` also fires on PR open events but runs in the base repository context and is intended for workflows requiring secrets or write access, not as the general PR-open trigger. `push` only fires on pushes to branches, not on PR opens. Therefore, D is correct.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
pull_request_target: branches: [release]
Why it's wrong here
pull_request_target is a security-sensitive trigger that runs in the context of the base repository with access to secrets, intended for safely handling pull requests from forks; it is not the standard trigger for validating PRs and can expose secrets if misused, so it should not be used for a regular PR build.
- ✗
push: branches: [release]
Why it's wrong here
The push trigger on branches: [release] fires only when commits are directly pushed to the release branch, not when a pull request targeting release is opened or updated; since the developer wants automatic triggering on pull requests, this event type does not match the requirement.
- ✗
workflow_dispatch:
Why it's wrong here
workflow_dispatch is a manual trigger that requires a user to select the workflow in the GitHub UI or invoke the repository dispatch API; it does not respond to automated events like pull_request or push, so it will not automatically start the workflow as needed.
- ✓
pull_request: branches: [release]
Why this is correct
The pull_request trigger with branches: [release] is the standard and correct event for running a workflow whenever a pull request is opened, updated, or reopened against the release branch; it automatically validates the PR's merged result and meets the requirement precisely.
Go deeper
Related to this question
Learn chapter
Designing a Release Pipeline
Key term
Branch
A branch is a pointer to a specific commit in a version control system that allows you to work on features or fixes in isolation from the main codebase.
Key term
Pull request
A pull request is a way for a developer to propose changes to a codebase and ask other team members to review and merge them into the main project.
About these practice questions
Courseiva writes every AZ-400 question from scratch — 823 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This AZ-400 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AZ-400 exam.