DevOps / GitHub Actions Interview Questions
What are workflow triggers (on:) and which event types does GitHub Actions support?
The on: key defines which GitHub events cause a workflow to run. You can listen to a single event, a list of events, or an event with filters. GitHub provides more than 35 distinct event types across three broad categories.
Repository events fire when something happens in your repo:
push— a commit or tag is pushedpull_request— a PR is opened, synchronised, closed, etc.pull_request_target— same as above but runs in the context of the base branch (useful for forks)release— a release is published, edited, or deletedissues,issue_comment,discussioncreate,delete— branch or tag creation/deletion
Scheduled triggers use cron syntax:
on: schedule: - cron: '0 6 * * 1' # Every Monday at 06:00 UTC
Manual and cross-workflow triggers:
workflow_dispatch— lets you run the workflow manually from the GitHub UI or API, with optional input parametersworkflow_call— makes the workflow callable from another workflow (reusable workflows)workflow_run— triggers when another named workflow completesrepository_dispatch— triggers via a custom HTTP POST to the GitHub API, useful for external systems
Most event types accept additional filters. For example, push accepts branches:, tags:, and paths: filters so you only trigger on relevant changes instead of every push to every branch.
More Related questions...