DevOps / GitHub Actions Interview Questions
What is the difference between push, pull_request, and workflow_dispatch triggers?
These three triggers cover the most common CI/CD use-cases but serve very different purposes. Here is a direct comparison:
| Trigger | When it fires | Typical use-case | Key options |
|---|---|---|---|
push |
A commit is pushed to a branch or a tag is created | Deploy to staging/production after merging to main; publish a release on tag push | branches:, tags:, paths: |
pull_request |
A PR is opened, its head branch is updated (synchronised), or specific PR activity occurs (labeled, closed, etc.) | Run tests and linting on every proposed change before it merges; gate merges with required status checks | branches: (base branch filter), types: (activity type), paths: |
workflow_dispatch |
An operator manually triggers the workflow from the GitHub UI, the REST API, or gh workflow run |
Ad-hoc releases, environment-specific deployments, data migration scripts that should not run automatically | inputs: — define typed parameters (string, boolean, choice, environment) that the operator fills in before running |
A common pattern is to combine all three: use pull_request for pre-merge tests, push on main for deployment, and workflow_dispatch for manual rollback or hotfix releases. Each trigger runs independently so you can fine-tune which steps run for each event using if: github.event_name == 'push' inside steps.
More Related questions...