GitHub Actions Fundamentals interview question · Most asked

Explain how a GitHub Actions workflow is structured: events, jobs, steps, runners and actions.

How it works Asked in DevOps Engineer interviews

Members can save this page, take notes and track progress. See membership · Sign in

Summary

A workflow is a YAML file in .github/workflows/ triggered by events (push, pull_request, schedule, workflow_dispatch). It contains jobs that run in parallel by default (or in order with needs), each on a runner (a GitHub-hosted or self-hosted machine). A job is a list of steps; a step either runs a shell command (run) or uses an action (uses: actions/checkout@v4).

Longer Answer

  • Each job gets a fresh runner; share data between jobs with artifacts or job outputs, and speed up with caches.
  • Contexts and expressions: ${{ github.ref }}, ${{ secrets.X }}, if: github.event_name == 'push'.
  • Matrix runs one job definition across versions or platforms.
  • Environments add protection rules (required reviewers, wait timers, branch restrictions) and environment-scoped secrets.
  • Concurrency groups cancel or queue overlapping runs.

Example

name: CI
on:
  pull_request:
  push:
    branches: [main]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with: { node-version: 22, cache: npm }
      - run: npm ci
      - run: npm test

Key Points

  • Events trigger workflows; jobs run on runners.
  • Steps run commands or actions.
  • Jobs are parallel unless linked with needs.
  • Artifacts, outputs and caches move data between jobs.

Explanation

What interviewers look for

A correct mental model of what runs where, and how jobs share data.

More GitHub Actions Fundamentals questions

← All GitHub Actions Fundamentals questions

Last reviewed · By the ByteCamel team · How we write content

Was this page helpful?

Report a mistake