GitHub Actions in production

Workflows, reusable actions, matrix builds, OIDC to cloud (no long-lived keys), environments with approvals, self-hosted runners and their security tradeoffs.

About 27 min read3-question knowledge check

The mental model

GitHub Actions is an event-driven job runner that happens to live next to your code. Something happens in the repository — a push, a pull request, a tag, a schedule, a manual click — and GitHub looks in .github/workflows/ for any workflow that subscribed to that event. Matching workflows spin up fresh virtual machines, run your steps, and throw the machines away.

The analogy that sticks: a restaurant kitchen with disposable stations. An event is an order arriving. A workflow is the recipe card. A job is one cook at one station — and every job gets a brand-new, sterile station (a fresh VM) with nothing left over from the last order. That freshness is the feature: it makes runs reproducible. It is also the cost: anything you want carried between jobs must be explicitly handed over as an artifact or a job output, because the station is destroyed the moment the cook finishes.

Four nouns cover ninety percent of the mental load:

  • Workflow — a YAML file, subscribed to events, containing jobs.
  • **Job** — a unit that runs on one runner. Jobs run in parallel unless linked by needs.
  • **Step** — a shell command (run) or a reusable component (uses).
  • **Action** — a packaged step someone published; uses: actions/checkout@v4 is just "pull in this code and run it here."

The two facts that trip people up: jobs do not share a filesystem (each is a fresh machine), and the workflow file that runs is the one on the branch that triggered the event — so you cannot test a workflow change without pushing it somewhere the event fires.

The full lesson continues with 15 more sections
  • Deep dive
  • Internal architecture
  • Real-world use cases
  • Best practices
  • Common mistakes
  • Performance
  • Security
  • Production troubleshooting
  • Advantages & disadvantages
  • Alternatives
  • Interview expectations
  • Interview questions
  • Facts to remember
  • Cheat sheet
  • Quick revision