Episode 4 β Runners, Actions & the Marketplace
In the previous episodes, we learned:
- what CI/CD is
- how workflows, jobs, and steps are structured
- when workflows run using events and triggers
Now letβs answer a question every beginner (and many experienced devs) ask:
Where does my GitHub Actions code actually run?
And closely related:
What really happens when I use
uses:?
The Missing Piece: Execution
Until now, we focused on structure and triggers.
This episode is about execution.
In GitHub Actions, execution depends on three things:
- Runners β the machine that runs your job
- Actions β reusable logic blocks
- Marketplace β where most actions come from
1οΈβ£ What is a Runner?
A runner is simply a machine that executes your jobs.
Every job must declare:
runs-on: ubuntu-latest
This answers:
βWhich machine should run this job?β
Mental model:
Workflow β Job β Runner β Steps
2οΈβ£ GitHub-Hosted Runners (Most Common)
GitHub provides ready-to-use virtual machines.
Example:
runs-on: ubuntu-latest
Available options:
ubuntu-latestwindows-latestmacos-latest
What happens internally?
- GitHub spins up a fresh VM
- Your job runs
- VM is destroyed after completion
This means:
- no leftover files
- no shared state
- clean environment every run
Whatβs preinstalled on GitHub-hosted runners?
Most common tools are already there:
- Git
- Node.js, Python, Java
- Docker
- Build tools
Thatβs why CI setup feels βmagicalβ at first.
3οΈβ£ Self-Hosted Runners (When You Need More Control)
A self-hosted runner is a machine you own and manage.
Examples:
- Cloud VM (EC2, GCP, Azure)
- Company server
- On-prem machine
Usage:
runs-on: self-hosted
Or with labels:
runs-on: [self-hosted, linux, prod]
When do teams use self-hosted runners?
- Need access to internal network
- Custom hardware or licensed software
- Faster builds for large monorepos
- Enterprise deployments
For most projects, GitHub-hosted runners are enough.
4οΈβ£ What is an Action?
An action is a reusable block of logic.
Instead of writing everything yourself, you reuse actions created by:
- GitHub
- the community
- your own team
Example:
- uses: actions/checkout@v4
This single line:
- clones your repo
- authenticates securely
- supports PRs & private repos
Without it, the runner has no code.
5οΈβ£ run vs uses (Important Difference)
run
Runs shell commands you write.
- run: npm ci
uses
Executes reusable logic written by others.
- uses: actions/setup-node@v4
Rule of thumb:
- Project-specific logic β
run - Reusable setup logic β
uses
6οΈβ£ The GitHub Actions Marketplace
The Marketplace is a catalog of actions.
Think of it as:
- npm registry β but for CI logic
Popular actions:
- checkout code
- setup languages
- cache dependencies
- upload artifacts
- deploy apps
Most workflows use multiple marketplace actions.
7οΈβ£ Types of Actions (Under the Hood)
Actions can be implemented in different ways:
πΉ JavaScript actions
- Written in Node.js
- Fast
- Most common
πΉ Docker actions
- Run inside a container
- Full environment control
- Slower startup
πΉ Composite actions
- Multiple steps grouped together
- Great for reuse inside an org
Youβll mostly consume actions, not build them (at least initially).
8οΈβ£ A Complete Example (Everything Together)
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- run: npm ci
- run: npm run build
Whatβs happening:
- Job runs on GitHub-hosted Ubuntu
- Actions handle setup
- Commands handle project logic
This separation keeps workflows clean and readable.
Common Mistakes π¨
β Assuming runners persist data
β Writing long scripts instead of reusable actions
β Using untrusted marketplace actions
β Not pinning action versions
Good workflows are:
- explicit
- boring
- predictable
Final Mental Model (Lock This In)
Runner β where code runs
Action β reusable logic
run β your command
Marketplace β action library
Once this is clear, GitHub Actions becomes much easier to reason about.
Whatβs Next?
π Episode 5:
Secrets, Variables & Environments β Handling Credentials Safely
This is where we talk about:
- secrets vs variables
- repo vs environment secrets
- production safety
Follow the series to move from basics to production-ready pipelines π
Thanks for reading!
See you in the next episode π
Top comments (0)