The chain is repository plus YAML plus runner: an event fires, GitHub selects a runner, the runner executes steps, the result is reported back on the commit.
The lifecycle of a workflow run has five stages:
- Trigger. An event fires (push, pull request, schedule, manual dispatch).
- Match. GitHub reads the workflow files and selects those whose
on:clause matches the event and whose branch or path filters match the change. - Provision. GitHub allocates a runner for each job. Hosted runners are ephemeral: a fresh VM or container per job, destroyed afterwards. Self-hosted runners are persistent unless configured otherwise.
- Execute. The runner checks out the repository, sets up the environment, and runs the steps in order. Steps share a workspace but not a process; environment variables set in one step do not persist to the next unless written to
$GITHUB_ENV. - Report. The runner sends logs, artifacts and the job result back to GitHub. The commit status is updated, and downstream jobs that depend on this job may proceed or be cancelled.
Several features extend this core. Matrix builds run the same job across a combination of values (three Node.js versions × three operating systems = nine jobs) in parallel. Caching stores dependency directories between runs, keyed by a hash of the lockfile. Artifacts persist files after a job ends, for download or for a later job. Reusable workflows let one workflow call another, which is how organisations factor out shared pipelines. OIDC lets a workflow authenticate to a cloud provider without a long-lived secret: GitHub issues a short-lived JWT, and the cloud provider exchanges it for a scoped access token.