CI/CD · Ship safely, repeatedly

How do GitHub Actions workflows work?

Easygithub actionsworkflowsciUpdated Oct 2026
Quiz this track

Short answer

A workflow is a YAML file triggered by repository events. It contains jobs that run on runners, and each job has steps that call actions or shell commands. Reusable workflows and matrices reduce duplication.

Workflows live in .github/workflows and are triggered by events such as push, pull_request or a manual dispatch. Jobs run in parallel by default unless you declare dependencies with needs.

  • Use on to define events and paths that trigger the workflow
  • Use jobs and steps to structure work; steps in a job share a workspace
  • Use needs to express dependencies and pass outputs between jobs
  • Use a matrix to run the same job across versions or platforms
  • Set explicit permissions and pin third-party actions to a SHA
  • Use environments and required reviewers for protected deployments
yaml
name: ci
on:
  pull_request:
  push:
    branches: [main]

permissions:
  contents: read

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@<pinned-sha>
      - uses: actions/setup-node@<pinned-sha>
        with:
          node-version: 22
          cache: npm
      - run: npm ci
      - run: npm test
Workflows triggered by pull requests from forks run with read-only tokens and no secrets by default. Do not switch to a privileged trigger merely to make them work.

Follow-ups you should expect

Interviewers use these to check whether the first answer was understanding or memorisation.

  1. 1What is the difference between a reusable workflow and a composite action?
  2. 2How do jobs share data in GitHub Actions?
  3. 3How do you secure a workflow that deploys to production?
  4. 4What causes a workflow not to trigger?

Say it in the interview

A GitHub Actions workflow is YAML triggered by repository events. It defines jobs that run on hosted or self-hosted runners, and each job has steps that use actions or run commands. I use needs for dependencies, matrices for repeated combinations, and explicit permissions for security. Third-party actions are pinned to a SHA, and production deployments use protected environments.

Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.

Related questions

Reading is step one

Now say it out loud.

Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live CI/CD mock interview and get scored feedback on depth, clarity and confidence.