Introduction to GitHub Actions
Automate your build, test, and deploy — without leaving GitHub.
Every time you push code, a series of checks should run: build it, test it, maybe deploy it. Doing that by hand is slow and easy to forget. GitHub Actions automates it — running your pipeline automatically on every push, directly inside your repository. This is CI/CD.
🎯 Learning Objectives
By the end of this lesson you will:
- Understand what CI/CD means
- Know what GitHub Actions is and how it fits in
- Understand the core concepts: workflow, event, job, step, runner
- Recognise a workflow file when you see one
What is CI/CD?
| Term | Meaning |
|---|---|
| CI — Continuous Integration | Automatically build and test every change as it’s merged |
| CD — Continuous Delivery/Deployment | Automatically release that tested change to an environment |
The goal: catch problems early and ship reliably, without manual, error-prone steps.
💡 The one-line version
CI/CD is a robot that builds, tests, and ships your code every time you push — so humans don’t have to remember to.
What is GitHub Actions?
GitHub Actions is GitHub’s built-in automation platform. You describe a workflow in a YAML file inside your repo, and GitHub runs it automatically when chosen events happen — a push, a pull request, a schedule, and more.
Because it lives in your repo, there’s nothing extra to host — GitHub provides the machines (runners) that execute your workflows.
The Core Concepts
Event (push) ──triggers──▶ Workflow
└─ Job (runs on a runner)
└─ Step 1: checkout code
└─ Step 2: install deps
└─ Step 3: run tests| Concept | What it is |
|---|---|
| Workflow | The whole automated process (one YAML file) |
| Event | What triggers it (push, pull_request, schedule) |
| Job | A set of steps that run on one runner |
| Step | A single task (run a command or use an action) |
| Runner | The machine that executes a job |
| Action | A reusable, pre-built step you can drop in |
Where Workflows Live
Workflow files go in a special folder: .github/workflows/. A minimal one:
# .github/workflows/hello.yml
name: Hello
on: push
jobs:
greet:
runs-on: ubuntu-latest
steps:
- run: echo "Hello from GitHub Actions!"Push this file, and GitHub runs the job automatically. You’ll see the result under the repo’s Actions tab.
The Marketplace Advantage
You rarely start from scratch. The GitHub Marketplace has thousands of pre-built actions — checkout code, set up Node/Python, cache dependencies, deploy to a cloud — that you reference with uses:.
steps:
- uses: actions/checkout@v4 # check out your repo
- uses: actions/setup-node@v4 # install Node.js
with:
node-version: 20💡 uses vs run
run: executes a shell command. uses: pulls in a reusable action someone already built. Combining them is how you assemble powerful pipelines quickly.
🧪 Hands-on Lab
Create Your First Workflow
- Add a workflow file at
.github/workflows/ci.ymltriggered onpush - Add a job that checks out the code and prints the repository contents
- Push it and check the Actions tab for a green run
🧠 Knowledge Check
What does Continuous Integration (CI) primarily do?
Where must GitHub Actions workflow files be placed?
💼 Interview Preparation
What are the benefits of CI/CD, and how does GitHub Actions provide it?
Summary
You now understand CI/CD, what GitHub Actions is, and its core building blocks: workflows, events, jobs, steps, and runners. Next, you’ll break down the anatomy of a workflow file in detail.