What Actually Triggers a CI/CD Pipeline to Start
A developer finishes a bug fix, types git push, and walks away. A few minutes later, the team chat lights up: "Build failed." Nobody touched the pipeline configuration. Nobody clicked a button. The pipeline just ran.
This is normal in most teams. But if you ask someone why the pipeline ran, the answer is often vague: "Because I pushed code." That is true, but it skips over an important detail. Pipelines do not start themselves. Something has to trigger them. And the type of trigger you choose changes how your team works, what gets tested, and when things go to production.
Let's walk through the real situations where pipelines start, and what each trigger means for your daily workflow.
When a Developer Pushes Code
The most common trigger is a commit pushed to a shared repository. A developer finishes a change, commits it locally, and pushes to GitHub, GitLab, or Bitbucket. The repository sends a webhook to the CI/CD system, and the pipeline starts.
This sounds simple, but the details matter. The commit carries metadata: which files changed, who made the change, and the commit message. A good pipeline uses this metadata to decide what to do. If the commit only touches a README file, you probably do not need to run the full test suite and deploy to staging. But if the commit changes application code, the pipeline should run everything.
The diagram below shows how a push trigger branches based on commit metadata:
Here is how you might define such a push trigger in a GitHub Actions workflow:
name: CI Pipeline
on:
push:
branches:
- main
- 'feature/**'
paths-ignore:
- 'README.md'
- 'docs/**'
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run tests
run: make test
Teams that treat every commit the same way waste time and compute resources. A smarter approach is to let the pipeline inspect the commit and branch before deciding the next step. For example, a commit on a feature branch might only run unit tests and linting, while a commit on the main branch triggers integration tests and a staging deployment.
When a Pull Request Gets Merged
Many teams use pull requests or merge requests as a review gate. A developer opens a PR, teammates review the code, and when it is approved, someone merges it. The merge itself can be a trigger.
This is different from a regular commit trigger. A merge usually signals that the change has passed human review and is ready to enter a more stable branch. Pipelines triggered by merges often run stricter checks: longer test suites, security scans, or database migration tests. The assumption is that this change will soon go to production, so you want more confidence.
Some teams also run pipelines on the pull request itself, before merge. This gives early feedback. But the merge trigger is the moment of truth. Once the code is in the main branch, it becomes part of the shared history. A failed pipeline at this point means the team needs to fix it quickly, because other developers will pull that broken code.
When the Clock Says So
Not all pipelines need a code change to run. Scheduled triggers start a pipeline at a specific time, regardless of whether anyone pushed code.
Common use cases include:
- Running long integration tests every night when nobody is waiting for results.
- Refreshing staging environments with production data snapshots.
- Updating dependency versions or running vulnerability scans.
- Performing backups or cleanup tasks.
Scheduled triggers are useful for work that should happen regularly but does not depend on a developer's activity. They also catch problems that only appear over time, like a slowly degrading test environment or a certificate about to expire.
The downside is that a scheduled pipeline might run when nothing has changed. If it fails, someone has to investigate whether the failure is real or just a flaky test. Teams should keep scheduled pipelines focused on tasks that genuinely need periodic execution, not on things that could be triggered by a code change.
When Someone Hits the Button
Manual triggers give a human the final say. Instead of the pipeline starting automatically, someone logs into the CI/CD system and clicks "Run" or "Deploy."
This is common for production deployments. Even if all automated checks pass, many teams want a person to explicitly approve the deployment. Manual triggers also handle emergency situations: rolling back to a previous version, redeploying after an environment crash, or running a one-off data migration.
Manual triggers are not just about control. They also carry responsibility. When someone manually starts a pipeline, they should record why. A good CI/CD system lets you add a note: "Rolling back to v2.1.3 because the latest release has a database connection leak." This metadata becomes part of the audit trail.
The risk with manual triggers is that they become a bottleneck. If every deployment requires someone to click a button, and that person is on leave, nothing ships. Teams should reserve manual triggers for actions that genuinely need human judgment, not for routine steps that could be automated.
Why Metadata Matters More Than You Think
Every trigger carries information. A commit trigger carries the commit hash, branch name, and author. A merge trigger carries the pull request number and reviewer names. A manual trigger carries the operator's name and their stated reason.
This metadata is not just for logging. The pipeline uses it to make decisions. Should it run a full test suite or just smoke tests? Should it deploy to staging or production? Should it notify the on-call engineer or just post a summary to the team channel?
Without metadata, the pipeline is blind. It runs the same steps every time, regardless of what changed. That works for simple projects, but as your system grows, you need conditional logic. The trigger is the first place to inject that logic.
A Quick Checklist for Choosing Triggers
If you are setting up a new pipeline or reviewing an existing one, these questions help you decide which triggers to use:
- Does every commit need the same pipeline, or can you skip steps for documentation-only changes?
- Do you want feedback on pull requests before merge, or only after merge?
- Are there tasks that should run daily even if nobody pushes code?
- Which steps need human approval, and which can run automatically?
- Does your pipeline capture enough metadata to debug failures later?
The Takeaway
A pipeline trigger is not just a start button. It is a decision point that defines when work begins, what context is available, and how much automation is safe. Choose triggers based on the risk and frequency of each action, not on habit. A well-triggered pipeline runs the right checks at the right time, without waiting for someone to remember to click a button.