█
LastWrite
  • > Curriculum
  • > Pricing
  • > For Educators
  • > About
  • > Contact
Log InGet Started

Questions, concerns, bug reports, or suggestions? We read every message, write to us at [email protected].

More ways to reach us →
LastWrite

Structured computer science lessons for aspiring developers and security professionals.

[email protected]

(201) 785-7951

Mon–Fri, 9 AM–5 PM EST

Learn

  • Curriculum
  • Pricing

Company

  • About
  • For Educators & Schools
  • Contact Us

Legal

  • Terms of Service
  • Privacy Policy
© 2026 LastWrite. All rights reserved.
Curriculum/DevOps and Infrastructure/CI/CD Pipelines/GitHub Actions in Depth
50 minIntermediate

GitHub Actions in Depth

After this lesson, you will be able to: Use GitHub Actions in depth: triggers, jobs, steps, runners, matrix builds, and reusable workflows.

GitHub Actions is the default CI/CD platform for most new projects. This lesson covers the surface area you'll use daily.

Prerequisites:What CI/CD Is

Anatomy of a workflow

A workflow is YAML in `.github/workflows/*.yml`. Workflow has triggers (when to run), jobs (parallel units of work), steps (commands within a job). Each job runs in a fresh ephemeral VM (the runner). Jobs share state via `needs:` (dependency) + artifact upload/download.

Triggers — when workflows run

The common patterns. See docs.github.com/actions for the full list.

tsx
on:
push:
branches: [main]
paths: ['src/**', 'package.json'] # only when these change
pull_request:
schedule:
- cron: '0 6 * * *' # daily 06:00 UTC
workflow_dispatch: # manual button in GitHub UI
inputs:
env:
type: choice
options: [staging, production]
workflow_call: # callable from other workflows

A real multi-job workflow

Lint + test in parallel, then build (depends on both).

tsx
name: CI
on:
pull_request:
push:
branches: [main]
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
pull-requests: write
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: 20, cache: npm }
- run: npm ci
- run: npm run lint
test:
runs-on: ubuntu-latest
strategy:
matrix:
node: [18, 20, 22]
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: ${{ matrix.node }}, cache: npm }
- run: npm ci
- run: npm test -- --run
build:
needs: [lint, test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: 20, cache: npm }
- run: npm ci && npm run build
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist/

Matrix builds: parallelism for free

A matrix expands one job into many parallel runs across one or more dimensions. Common dimensions: language versions (node 18/20/22, python 3.10/3.11/3.12), OS (ubuntu/macos/windows), test shard (split tests across N runs). `fail-fast: false` (recommended) keeps running the other matrix entries even if one fails, so you see ALL failures.

Reusable workflows + composite actions

Reusable workflow: a workflow callable from another (`uses: ./.github/workflows/release.yml`). Share entire pipelines. Composite action: a step bundle (a 'mini-action' in `.github/actions/foo/action.yml`). Share groups of steps. Both let you DRY across many repos in your org without copy-paste.

Common mistakes only experienced engineers avoid

Skipping `concurrency:` cancel-in-progress. A 30-commit push runs 30 workflows; only the last matters. Forgetting `permissions:`. Modern GitHub defaults are read-only; jobs that need write access (deploys, releases) must declare them explicitly. Reinventing actions you can buy off-the-shelf. actions/checkout, actions/setup-node, docker/build-push-action are vetted and fast. Workflows that take 30 min. Cache aggressively, parallelize jobs, shard tests. Echoing secrets to logs. GitHub auto-masks SECRETS named ones, but `echo $SECRET` to stdout leaks if the var isn't a secret.

Quick Check

Your CI takes 25 minutes. Where do you look FIRST?

Pick the highest-leverage diagnostic.

Sign in and purchase access to unlock this lesson.

Sign in to purchase
←What CI/CD Is
Back to CI/CD Pipelines
A Complete CI Pipeline→