Courseiva
Design and implement build and release pipelineseasyMultiple ChoiceObjective-mapped

AZ-400 Practice Question: Design and implement build and release pipelines

Your team uses GitHub Actions for CI/CD. You need to ensure that only specific branches can trigger the deployment workflow to production. Which workflow trigger should you configure?

⚠ Common exam trap

A common mix-up: candidates confuse `pull_request` triggers with `push` triggers, thinking a PR merge to `main` counts as a push, but `pull_request` triggers on PR lifecycle events (like `opened` or `synchronize`), not the merge commit itself, which would require a `push` trigger on `main`.

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

on: push: branches: [main]

The `on: push: branches: [main]` trigger ensures that the deployment workflow runs only when a push event occurs on the `main` branch. This directly enforces the requirement that only specific branches (here, `main`) can trigger production deployments, preventing accidental or unauthorized deployments from other branches.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • on: push: branches: [main]

    Why this is correct

    This trigger fires the workflow automatically on every push to the main branch. The branch filter ensures that only commits pushed to main start the CI pipeline, so builds and tests run on the intended integration branch while ignoring feature branches.

  • on: pull_request: branches: [main]

    Why it's wrong here

    A pull_request trigger runs on pull request events such as opened, synchronized, or reopened, not on direct pushes to main. Since the requirement is to respond to push events to main, this trigger would not execute the workflow when commits are pushed directly to that branch.

  • on: workflow_dispatch: inputs: branch: description: 'Select branch'

    Why it's wrong here

    workflow_dispatch enables manual execution of the workflow from the GitHub UI or API; it does not respond to branch pushes. The input named 'branch' only provides a user-selectable parameter at runtime, but it has no binding to push events, so the workflow cannot run automatically on a push to main.

  • on: schedule: cron: '0 0 * * *'

    Why it's wrong here

    A schedule trigger runs the workflow at a fixed time (daily at midnight UTC) irrespective of any commits or pushes. It does not react to push events, so it cannot provide immediate or event-driven CI feedback when code is pushed to main, making it unsuitable for this requirement.

About these practice questions

One of 823 original AZ-400 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

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.