CV0-004 Deployment Practice Question
A DevOps team is setting up a CI/CD pipeline using GitHub Actions. They want the pipeline to automatically deploy a containerized application to a Kubernetes cluster only when changes are pushed to the main branch. Which GitHub Actions component should they use to trigger the deployment?
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
✓
A workflow with an on.push trigger for the main branch
GitHub Actions workflows are defined in YAML and can include an 'on' trigger specifying events such as push to a branch. This allows automation of the deployment when code is pushed to main.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
A cron job that checks the repository every hour
Why it's wrong here
A cron schedule fires on elapsed time, not on push events, so deployments would run regardless of whether main changed and could miss or duplicate commits. Scheduled workflows suit nightly builds or periodic housekeeping, not event-driven deployment on main-branch pushes.
- ✗
A GitHub webhook configured in the repository settings
Why it's wrong here
A repository webhook delivers event payloads to an external HTTP endpoint; it does not itself define or run a workflow. Webhooks suit integrating GitHub with third-party systems, whereas the push event trigger inside the workflow file starts the deployment job.
- ✗
A pull request review requirement
Why it's wrong here
A pull request review requirement gates merges through approvals; it neither detects a push to main nor starts a workflow run. Required reviewers suit protecting branches from unreviewed merges, not triggering deployment after code has already landed on main.
- ✓
A workflow with an on.push trigger for the main branch
Why this is correct
The on.push trigger with a main branch filter causes the workflow to run only when commits are pushed to main, satisfying the conditional deployment requirement. This event-driven trigger is the GitHub Actions component that initiates the pipeline at the correct moment.
Go deeper
Related to this question
About these practice questions
This CV0-004 question is part of Courseiva's 834-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam 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 CV0-004 practice question is part of Courseiva's free CompTIA 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 CV0-004 exam.