Intro to GitHub Actions (CI/CD)
Stop running tests by hand. By the end of this lesson you'll write a workflow YAML file that runs your test suite automatically on every push and pull request — your first taste of continuous integration, built right into GitHub.
Learn Intro to GitHub Actions (CI/CD) in our free Git course — a beginner-friendly interactive lesson with worked examples, a practice exercise and a quick…
Part of the free Git course at LearnCodingFast — hands-on lessons with examples you run in your browser, plus practice exercises and a quick quiz.
1️⃣ Your First Workflow
A workflow is a YAML file in .github/workflows/ . This one runs your tests on every push to main and on every pull request. Commit it, push, and the run shows up in the repo's Actions tab.
2️⃣ The Anatomy of a Workflow
Every workflow shares the same skeleton: name , the triggering events under on , and jobs . Each job sets runs-on (the runner) and a list of steps . A step either uses a prebuilt action or run s shell commands.
3️⃣ Testing Across Versions (Matrix)
A matrix runs the same job several times in parallel — once per value you list. It's the standard way to prove your code works on multiple language versions at once, with one small block of YAML.
Your turn. Complete a minimal CI workflow. Fill in the three blanks, then commit it as .github/workflows/ci.yml .
📋 Quick Reference
No file given this time — just the plan. Wire up real continuous integration and watch it pass, then fail.
Practice quiz
What is GitHub Actions?
- A code editor
- A merge strategy
- GitHub's built-in CI/CD system that runs workflows on events
- A branch type
Answer: GitHub's built-in CI/CD system that runs workflows on events. GitHub Actions automates building, testing, and deploying code in response to repository events.
Where must workflow files live in your repo?
- In .github/workflows/
- In the repo root
- In .git/hooks/
- In /actions/
Answer: In .github/workflows/. Workflow YAML files go in the .github/workflows/ directory of your repository.
What format are workflow files written in?
- JSON
- TOML
- XML
- YAML
Answer: YAML. GitHub Actions workflows are YAML files (.yml or .yaml).
What does the top-level 'on:' key define?
- The operating system
- The events that trigger the workflow (e.g. push, pull_request)
- The output
- The owner
Answer: The events that trigger the workflow (e.g. push, pull_request). 'on' lists the events — like push or pull_request — that start the workflow.
What is a 'job' in a workflow?
- A set of steps that run on one runner machine
- A single command
- A commit
- A secret
Answer: A set of steps that run on one runner machine. A job groups steps that execute together on a runner; jobs can run in parallel by default.
What does 'runs-on: ubuntu-latest' specify?
- The programming language
- The branch
- The runner (virtual machine) the job executes on
- The schedule
Answer: The runner (virtual machine) the job executes on. runs-on chooses the runner OS/image, such as ubuntu-latest, for that job.
What does the 'uses:' keyword in a step do?
- Runs a shell command
- Pulls in a reusable action (e.g. actions/checkout@v4)
- Sets an environment variable
- Declares a job
Answer: Pulls in a reusable action (e.g. actions/checkout@v4). 'uses' references a prebuilt action from the Marketplace or a repo, like actions/checkout.
What does the 'run:' keyword do in a step?
- Imports an action
- Triggers the workflow
- Creates a job
- Executes shell commands on the runner
Answer: Executes shell commands on the runner. 'run' executes shell commands directly, e.g. run: npm test.
Why is actions/checkout usually the first step?
- It deploys the app
- It checks out your repository code onto the runner so later steps can use it
- It installs Node
- It opens a PR
Answer: It checks out your repository code onto the runner so later steps can use it. The runner starts empty, so actions/checkout fetches your code before tests can run.
Where do you find reusable, prebuilt actions?
- The Issues tab
- The Wiki
- The GitHub Marketplace
- The Releases page
Answer: The GitHub Marketplace. The GitHub Marketplace hosts thousands of prebuilt actions you reference with 'uses'.