Lesson 02 · GitHub platform · actions
Automation that runs when your repo changes. One YAML file, three nested ideas — workflow, job, step — and you can read or write any basic CI pipeline.
An Action (the workflow, really — "Actions" is GitHub's name for the whole feature) is code that runs on GitHub's own servers in response to something happening in your repo: a push, a PR, a schedule, a manual button click. No servers to manage — you write YAML, GitHub runs it.
Every workflow file lives at .github/workflows/<name>.yml — that exact folder is how GitHub finds it, nothing to register elsewhere.
push, pull_request, schedule (cron), workflow_dispatch (manual "Run workflow" button). Can scope to branches: on: {push: {branches: [main]}}.needs: another job.ubuntu-latest unless you specifically need Windows or macOS.uses: runs someone else's packaged action (from the Marketplace); run: runs a raw shell command. Mix freely.actions/checkout@v4 is the near-universal first step: it clones your repo onto the runner so later steps (run: commands, build tools) have something to work on. Forgetting it is the most common first-workflow bug — every file-based command after it just fails to find anything.
This workspace has no build step (see CLAUDE.md — static HTML, nothing compiles), so "CI" here means something honest and small: a sanity check that fails loudly if something's actually broken, not a fake green checkmark.
name: CI
on:
push:
branches: [main]
pull_request:
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: root index.html exists
run: test -f index.html
Two triggers at once: every push to main, and every pull request (against any branch) — so a broken PR gets flagged before it merges, not after. test -f is a plain shell check, not a special GitHub thing — anything you could type at a terminal works in a run: step.
.github/workflows/ci.yml with the YAML above (or your own small check — e.g. confirm every course's index.html exists). Commit and push to a branch, open a PR, and watch the Checks section at the bottom of the PR run it live. Then check the Actions tab at the repo's top nav — every run, past and present, lives there with full logs per step.
Primary source — read this one: GitHub Docs — Actions Quickstart. Walks the exact workflow → job → step structure with a real example.
Then do it for real: GitHub Skills — Hello GitHub Actions, or the CI workflow you just wrote above.