What are pipeline triggers?
BeginnerConceptCI/CD practices
Answer
In one line: Triggers are the events that start a pipeline automatically — such as a push, a pull request, a schedule, a tag or a manual button.
Common triggers:
- Push — runs when code is pushed to a branch (for example build and deploy on push to
main). - Pull request / merge request — runs CI checks on proposed changes before merging.
- Tag / release — runs a release pipeline when a tag like
v1.4.0is created. - Schedule (cron) — nightly builds, nightly security scans, weekly dependency checks.
- Manual — a person starts it, often with inputs (environment, version). In GitHub Actions:
workflow_dispatch. - Upstream pipeline — one pipeline finishing triggers another (for example a shared library build triggers the apps that use it).
- Webhook / API / external event — a new image in a registry, a ticket approved, or a call from another system.
- Path filters — only run when certain files change (useful in monorepos).
Example (GitHub Actions):
on:
pull_request:
branches: [main]
push:
branches: [main]
paths: ["services/orders/**"]
schedule:
- cron: "0 2 * * *" # every night at 02:00 UTC
workflow_dispatch:
inputs:
environment:
type: choice
options: [staging, production]
Choosing triggers well:
- PRs → fast checks (build, unit tests, lint, scans).
- Merge to main → full pipeline and deploy to dev/staging.
- Tags or approvals → production.
- Nightly → slow tests, full security scans.
Tip for interviews: mention path filters for monorepos and the difference between PR checks and post-merge deployment pipelines.
More on CI/CD practices
What is "pipeline as code", and why is it better than configuring pipelines in a UI?BeginnerWhat is a build agent or runner?BeginnerWhat is a quality gate in a CI/CD pipeline?BeginnerHow do you make a slow CI/CD pipeline faster?BeginnerWhat are secrets in CI/CD, and how should they be handled?BeginnerWhat is a monorepo vs a polyrepo, and how does it affect CI/CD?Beginner