DevOps / Github Interview questions
How does GitHub Actions decide which workflow to trigger for a given event?
GitHub scans every workflow file under .github/workflows/ in the repository and evaluates each one's on block against the incoming event independently; there's no single "the workflow" concept, and multiple workflows can trigger from the same event simultaneously if their conditions all match.
Matching happens on several axes at once: the event type itself (push, pull_request, schedule, workflow_dispatch, and dozens more), and, for many event types, additional filters like branches, tags, or paths. A workflow only runs if every specified filter condition is satisfied; a push trigger scoped to branches: [main] won't fire for a push to a feature branch, for instance.
Because evaluation is per-file and independent, it's entirely normal for a single push to trigger three separate workflow files at once, one for tests, one for linting, one for a container build, each defined and evaluated on its own rather than as steps within one master pipeline definition.
More Related questions...