Sub topic 1
What a Runner Is and How It Picks Up Jobs
Prerequisites
You should know basic GitHub Actions syntax, including on, jobs, steps, and runs-on. You should also be comfortable with a Linux shell, Git pull requests, and the basic purpose of containers or virtual machines.
What a Runner Does
A runner is a machine or virtual machine that executes the steps in a GitHub Actions job. The runner application connects to GitHub, waits for work, downloads the workflow instructions, and runs each step in order. It then sends logs, results, and status back to GitHub.
The workflow chooses a runner with runs-on. GitHub matches that value against labels registered on available runners. A matching runner claims the job and starts it.
GitHub-Hosted and Self-Hosted Runners
GitHub-hosted runners are temporary virtual machines managed by GitHub. They have standard tools, receive maintenance from GitHub, and provide a simple default for most projects.
Self-hosted runners are machines that your team manages. They can provide custom software, private network access, specialized hardware, or predictable build environments. They also make your team responsible for operating-system updates, runner updates, isolation, logging, and cleanup.
A self-hosted machine may retain files, processes, credentials, or tool caches after a job. Later chapters explain why reusing such a machine can expose one job to another.
Registering a Runner and Choosing Its Scope
Registration connects a runner to GitHub. You can register it for a repository, an organization, or an enterprise. A repository runner has the narrowest scope. An organization or enterprise runner can serve multiple repositories, so access control becomes more important.
GitHub uses a short-lived registration token during setup. The token authorizes registration; it is not a replacement for controlling which workflows may use the runner.
Routing Jobs with Labels
Labels describe a runner's capabilities and ownership. A job can list several labels. The runner must have every listed label before it can receive the job.
name: test
on: pull_request
permissions:
contents: read
jobs:
test:
runs-on: [self-hosted, linux, x64, ephemeral]
steps:
- uses: actions/checkout@v4
- run: make testThis job requires a self-hosted Linux runner with an x64 architecture and the ephemeral label. Labels express routing requirements, not security boundaries. Use runner groups and workflow permissions to control access.
Exercise
A job uses runs-on: [self-hosted, linux, x64]. Can a runner labeled self-hosted, linux, and arm64 run it?
Show answer
No. The runner lacks the required x64 label.