GitHub-hosted vs Self-hosted Runners
A runner is the machine that executes a job. GitHub offers managed virtual machines, and you can register your own. The choice affects cost, speed, what the job can reach, and security.
| GitHub-hosted | Self-hosted | |
|---|---|---|
| Machine | fresh VM per job, destroyed afterwards | your VM, container or bare metal |
| Images | Ubuntu, Windows, macOS, Linux and Windows on Arm, with many tools preinstalled; larger sizes and GPUs as paid "larger runners" | whatever you install |
| Cost | per-minute billing beyond the plan's included minutes (public repositories on standard runners: free) | your infrastructure and its maintenance; no per-minute charge for the runner itself |
| Network | the public internet; no access to private networks unless you add a VPN or Azure private networking | can sit inside your network: reach private registries, databases, clusters |
| Clean state | guaranteed for every job | only if you make runners ephemeral |
| Maintenance | none | OS patches, runner updates, autoscaling, monitoring |
Prices and included minutes change: check GitHub's current billing documentation.
Choosing a runner in a workflow
jobs:
test:
runs-on: ubuntu-24.04 # GitHub-hosted, pinned image version
build-arm:
runs-on: ubuntu-24.04-arm # GitHub-hosted Arm64
deploy:
runs-on: [self-hosted, linux, x64, prod-network] # all labels must match one runner
gpu-tests:
runs-on:
group: gpu-runners # a runner group (access controlled per repository)
labels: [linux, gpu]Prefer pinned images (ubuntu-24.04) over ubuntu-latest for anything you release: -latest moves to a new OS version on GitHub's schedule.
Registering a self-hosted runner
On a Linux machine (sample session: the token comes from Settings → Actions → Runners → New self-hosted runner and is valid for one hour):
V=2.338.2 # use the version the "New self-hosted runner" page shows, and check its SHA-256 there
mkdir actions-runner && cd actions-runner
curl -fsSLO "https://github.com/actions/runner/releases/download/v$V/actions-runner-linux-x64-$V.tar.gz"
tar xzf "actions-runner-linux-x64-$V.tar.gz"
./config.sh --url https://github.com/acme --token "$REG_TOKEN" \
--labels prod-network --runnergroup deploy-runners --ephemeral --unattended
./run.sh√ Connected to GitHub
Current runner version: '2.338.2'
2026-10-27 09:14:03Z: Listening for Jobs
--ephemeral makes the runner take one job and then unregister, so the next job gets a fresh machine. Without it, files, processes, Docker images and credentials (~/.docker/config.json, ~/.kube/config) left by one job are visible to the next.
Autoscaling with Actions Runner Controller
Running ephemeral runners by hand doesn't scale. Actions Runner Controller (ARC), maintained by GitHub, runs runners as pods in Kubernetes: a runner scale set listens for queued jobs and creates one fresh pod per job, scaling to zero when idle. It is installed with Helm charts (sample session):
helm install arc --namespace arc-systems --create-namespace \
oci://ghcr.io/actions/actions-runner-controller-charts/gha-runner-scale-set-controller
helm install shop-runners --namespace arc-runners --create-namespace \
--set githubConfigUrl=https://github.com/acme/shop \
--set githubConfigSecret=github-app-credentials \
--set maxRunners=10 \
oci://ghcr.io/actions/actions-runner-controller-charts/gha-runner-scale-setWorkflows then use the scale set's name as the label: runs-on: shop-runners. Cloud alternatives (AWS CodeBuild-hosted runners, the Terraform philips-labs module for EC2, and third-party runner providers) follow the same "one fresh machine per job" model.
Security: never self-hosted for public repositories
Anyone can open a pull request on a public repository, and a pull-request workflow runs the PR's code. On a self-hosted runner, that code runs inside your network with whatever the machine can reach. GitHub's guidance is to use self-hosted runners only with private repositories. Even then:
- use ephemeral runners, ideally in containers or VMs created per job;
- separate runner groups by trust: deployment runners with network access to production only for the repositories (and workflows) that deploy;
- give the runner machine no standing cloud credentials; use OIDC per job;
- keep runners updated (they auto-update by default; a runner too far behind stops receiving jobs).
A model: hosted or self-hosted?
The trade-off is mostly arithmetic plus maintenance time. The model compares monthly cost for a team at three usage levels, with made-up prices (replace them with your own quotes): a per-minute hosted price, and for self-hosted, compute cost plus engineering hours to maintain it:
HOSTED_PER_MIN = 0.008 # $ per Linux minute (illustrative)
INCLUDED_MIN = 3000 # minutes included in the plan (illustrative)
SELF_NODE_MONTH = 110 # $ per always-on runner VM (illustrative)
MIN_PER_NODE = 30 * 24 * 60 * 0.6 # a VM is busy ~60% of the time
ENGINEER_HOUR = 90
MAINT_HOURS = 6 # patching, upgrades, incidents per month
for monthly_minutes in (5_000, 100_000, 1_000_000):
hosted = max(0, monthly_minutes - INCLUDED_MIN) * HOSTED_PER_MIN
nodes = -(-monthly_minutes // int(MIN_PER_NODE)) # ceiling division
self_hosted = nodes * SELF_NODE_MONTH + MAINT_HOURS * ENGINEER_HOUR
cheaper = "hosted" if hosted < self_hosted else "self-hosted"
print(f"{monthly_minutes:>7} min/month: hosted ${hosted:>8,.0f} self-hosted ${self_hosted:>8,.0f} "
f"({nodes} VMs) -> {cheaper}") 5000 min/month: hosted $ 16 self-hosted $ 650 (1 VMs) -> hosted
100000 min/month: hosted $ 776 self-hosted $ 980 (4 VMs) -> hosted
1000000 min/month: hosted $ 7,976 self-hosted $ 4,830 (39 VMs) -> self-hosted
With these numbers, hosted runners win until usage is very high, mostly because the maintenance hours are a fixed cost; at a million minutes a month the fleet pays for its engineer. Cost is rarely the only reason, though. Teams choose self-hosted runners for network access (deploying into a private cluster), hardware (GPUs, large memory, Arm, macOS fleets), caches close to the build, or data residency, and stay on hosted runners for zero maintenance and isolation.
Test yourself
Why should self-hosted runners not be used for public repositories?
- They're slower
- Pull requests from anyone run their code on your machine, inside your network
- GitHub forbids it technically
- They can't access the internet
What does --ephemeral do when configuring a runner?
- Makes it faster
- The runner takes one job and then unregisters, so every job gets a fresh machine
- Deletes logs
- Disables updates
runs-on: [self-hosted, linux, gpu] selects which runners?
- Any runner with one of the labels
- Only runners that have all three labels
- GitHub-hosted GPU runners
- The first registered runner