How does GitHub-hosted runner billing work?
GitHub-hosted runners are virtual machines that GitHub provisions, patches, and tears down for you. Each job gets a fresh VM with a preinstalled toolchain, runs, and is discarded. Teams use them because they require no capacity planning, no image maintenance, and no cleanup between jobs, and because a clean machine per job removes a whole class of "works on the second run" bugs.
The trade-off is metered billing, which has three parts:
- Per-minute rates that vary by OS and size. Linux is the cheapest. Windows and macOS cost more per minute because of licensing and hardware costs. Larger runners with more vCPUs or GPUs carry higher rates.
- Per-job rounding. Each job's duration is rounded up to the next whole minute. A workflow that fans out into twenty 10-second jobs bills as twenty minutes, not about three. This is why matrix-heavy pipelines often cost more than their wall-clock time suggests.
- Included minutes. Your plan sets a monthly allowance, and repository visibility changes what counts against it. Standard runners on public repositories are generally free. Private repositories consume the allowance, and overage is billed.
Rates, allowances, and which runner types the allowance covers all change over time. Check GitHub's pricing page for current figures. This guide quotes no prices.
The alternative is self-hosted runners. You supply and operate the machines, and GitHub only dispatches jobs to them. Confirm on the pricing page whether any charge applies to self-hosted usage on your plan.
| Aspect | GitHub-hosted | Self-hosted |
|---|---|---|
| Machine ownership | GitHub | You |
| Cost model | Metered per minute | Infrastructure plus operations time |
| Clean environment per job | Default | Only if you build it |
| Maintenance burden | None | Images, patching, scaling |
What does a self-hosted runner actually cost?
The instance-hour price is only the first line of the bill. A complete model has six terms:
| Cost term | What drives it | Why it gets missed |
|---|---|---|
| Compute | Instance size, count, provisioned hours | Priced per hour, not per job |
| Storage | Cache volumes, artifacts, runner images | Grows quietly over time |
| Network | Egress, NAT gateway processing, image pulls | Billed on a separate line |
| Observability | Log ingestion, metrics, retention | Often sits in another team's budget |
| Control plane | Autoscaler, job queue, and their hosts | Treated as free glue |
| Engineer time | Patching, image rebuilds, hardening, incidents | Never invoiced |
Engineer time is usually the largest hidden term. Runner images need regular OS and toolchain updates. A runner that executes pull-request code needs isolation and tightly scoped credentials. When the autoscaler stalls, every team's pipeline stops until someone fixes it. A few hours a month of senior time can exceed the compute bill.
Utilization sets the real price per minute, because you pay for capacity whether or not jobs run:
effective cost per useful minute = total monthly cost ÷ job minutes actually executed
A fleet sized for the mid-morning peak sits idle overnight and on weekends. The cost stays fixed while the useful minutes shrink. Scaling to zero removes idle capacity but adds cold-start delay. Keeping warm runners cuts queue time but means paying for idle machines. That tradeoff between queueing and overprovisioning is a decision to make on purpose.
Spot or preemptible instances lower the hourly rate, but the provider can reclaim them and kill jobs mid-run. Retries add compute minutes and developer wait time. For long or non-idempotent jobs, those costs can cancel out the discount.
When do self-hosted runners break even? A worked example
The rest of this section puts those costs into a formula you can rerun with your own data.
Illustrative estimate. None of these inputs are measured or quoted vendor prices:
- 200,000 job minutes per month
- Hosted rate of $0.008 per minute
- Instance cost of $0.20 per hour
- Maintenance at $100 per hour of loaded engineer cost
Hosted cost is minutes × rate: 200,000 × $0.008 = $1,600/month.
Self-hosted cost is ((minutes ÷ 60) ÷ utilization) × instance hourly cost + maintenance hours × loaded hourly cost.
Utilization sits in the denominator because you pay for idle instance-hours. At 50% utilization, 3,333 busy hours require 6,667 paid hours.
| Utilization | 4 maint. hrs | 10 maint. hrs | 20 maint. hrs |
|---|---|---|---|
| 25% | $3,067 | $3,667 | $4,667 |
| 50% | $1,733 | $2,333 | $3,333 |
| 75% | $1,289 | $1,889 | $2,889 |
Against $1,600 hosted, self-hosting wins in only one cell: high utilization with light maintenance. Moving from 4 to 10 maintenance hours, about one extra afternoon a month, erases the advantage even at 75% utilization.
Most of that maintenance time goes to patching images, debugging stuck runners and tuning autoscaling. Those are hours your platform engineers don't spend on product work, so this choice shows up in development cost as well as in the infrastructure bill.
Treat the result as perishable. Job volume grows, teams change and vendors revise pricing, and any one of those shifts can move you to a different cell. Recompute the model every quarter, and again after any major workload or pricing change.
# Break-even model for self-hosted vs hosted CI runners.
# All inputs are ILLUSTRATIVE ASSUMPTIONS, not measured or quoted prices.
JOB_MINUTES = 200_000 # job minutes per month
HOSTED_RATE = 0.008 # USD per hosted minute
INSTANCE_HOURLY = 0.20 # USD per self-hosted instance-hour
ENGINEER_HOURLY = 100.0 # loaded engineer cost, USD per hour
def hosted_cost(minutes, rate):
return minutes * rate
def self_hosted_cost(minutes, utilization, instance_hourly, maint_hours, eng_hourly):
# Divide by utilization: you pay for idle instance-hours as well as busy ones.
paid_hours = (minutes / 60) / utilization
return paid_hours * instance_hourly + maint_hours * eng_hourly
hosted = hosted_cost(JOB_MINUTES, HOSTED_RATE)
print(f"Hosted: ${hosted:,.0f}/month")
# Sensitivity table: vary the two inputs that most often flip the result.
maint_options = [4, 10, 20]
print("Util " + "".join(f"{m:>3} maint hrs " for m in maint_options))
for util in [0.25, 0.50, 0.75]:
cells = []
for maint in maint_options:
cost = self_hosted_cost(JOB_MINUTES, util, INSTANCE_HOURLY, maint, ENGINEER_HOURLY)
marker = "*" if cost < hosted else " " # * = self-hosted is cheaper
cells.append(f"${cost:>8,.0f}{marker} ")
print(f"{util:>4.0%} " + "".join(cells))
# Rerun quarterly with current job minutes, rates and maintenance logs.
A small Python script that implements the break-even formula and prints the utilization-by-maintenance-hours sensitivity table from the illustrative inputs. An asterisk marks each cell where self-hosting is cheaper than the hosted cost.
How should you reduce CI spend before changing runners?
Before re-pricing your runners, cut the minutes you consume. A minute you don't run is cheaper than a cheaper minute, and it also shortens the wait for feedback.
- Path filters and conditional jobs. Use
pathsorpaths-ignoreon triggers, andif:conditions on jobs, so a docs-only change doesn't start the full integration suite. Every skipped job saves its billed minutes and frees a slot in the queue. - Concurrency groups. A
concurrencygroup keyed on the branch, withcancel-in-progress: true, kills runs made obsolete by a newer push. Nobody reads results for a commit that has already been replaced, so those minutes are pure waste. - Caching. Caching dependencies and build outputs with
actions/cacheor a setup action's built-in cache avoids re-downloading and recompiling unchanged code on every run. Key the cache on lockfile hashes so it invalidates correctly. - Splitting slow suites. Sharding tests across a matrix mainly reduces wall-clock time. Total minutes can rise slightly because each shard repeats setup, so measure both before and after.
- Right-sizing. Larger runners cost more per minute. They only pay off if the job finishes proportionally faster. Benchmark CPU-bound builds, and keep I/O-bound jobs on the smallest runner that works.
- Timeouts. Set
timeout-minutesclose to a job's normal duration. The default allows a hung job to run for hours before it is killed. - Scheduled workflows. Audit
scheduletriggers. Nightly jobs that nobody reads still bill every night.
The accompanying example combines path filters, a cancelling concurrency group, a timeout and a cache step.
name: ci
on:
push:
branches: [main]
pull_request:
# Skip CI entirely for docs-only changes
paths-ignore:
- 'docs/**'
- '**.md'
# One active run per workflow and branch; a newer push cancels the older run
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
# Kill hung builds well before the default limit; set near normal duration
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
# Reuse the npm download cache; key changes only when the lockfile changes
- uses: actions/cache@v4
with:
path: ~/.npm
key: npm-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
restore-keys: |
npm-${{ runner.os }}-
- run: npm ci
- run: npm test
A minimal GitHub Actions workflow that skips docs-only changes, cancels superseded runs on the same branch, caps job runtime with timeout-minutes, and caches npm downloads keyed on the lockfile hash.
How do you measure CI usage and spend?
Start with the billing and usage pages in your organization or account settings. The usage report you can download there breaks hosted-runner consumption down by repository and by runner type. Sort it by minutes and look at the top entries. CI spend is usually concentrated: a handful of repositories and one or two workflows in each tend to account for most of the bill. Those are where optimization or migration pays off first.
The billing report tells you where minutes go, but not why. For that, open the workflow run history of the top consumers and compare job durations across runs. A test job that takes three times longer on some runs than others usually points to cache misses, flaky retries, or an oversized matrix. You can't see any of that in a billing total.
Baseline metrics to record
Capture these per workflow, over at least a few weeks of normal activity:
- Queue time: how long a job waits before it starts. Self-hosted pools that are too small make this worse.
- Job duration: median and slow-tail values, measured separately for each job.
- Minutes per run: the sum across all jobs, which is what you actually pay for.
- Failure and retry rate: each rerun repeats the minutes it consumed.
This baseline is what makes the break-even model from the earlier section credible. Without it, "monthly minutes" is a guess. With it, you can compare runner options on the same workloads. After migrating, re-measure the same metrics to confirm that the savings are real and that queue time hasn't increased.
Self-hosted jobs don't appear as billed minutes. Keep collecting duration data from run history after you move, or the comparison stops working.
What are ephemeral runners and how do you provision them?
A persistent self-hosted runner keeps state between jobs: files left in the workspace, cached credentials, installed packages, and anything a malicious pull request managed to leave behind. An ephemeral runner removes that state by accepting exactly one job and then being destroyed. Every job starts from a known image, so builds can be reproduced and one job cannot contaminate the next. This is the recommended setup, especially for repositories that accept outside contributions.
The flow looks like this:
job queued → autoscaler sees demand → provisions VM or pod → runner registers → runs one job → deregisters → destroyed
You can provision these runners in two common ways. The first is autoscaled VMs, where a controller watches the job queue or webhook events and launches instances from a prebuilt machine image. The second is a Kubernetes-based controller, which schedules runner pods on demand. VMs give stronger isolation and work better for Docker-in-Docker builds. Pods start faster and pack more densely onto nodes.
Ephemerality has costs that a minutes comparison won't show:
- Startup latency. Boot or scheduling time plus registration adds to every job.
- Image pulls. Large runner images slow cold nodes noticeably.
- Lost warm caches. Dependency and build caches disappear with the runner.
You can recover much of the cache loss with a remote cache, such as a co-located object store, a package proxy, or a registry mirror in the same region. Keeping the cache close also avoids egress charges.
Plan for these failure modes:
- Scale-up lag. Bursts can queue jobs while capacity starts. A small warm pool absorbs them.
- Stuck instances. Runners that never register or never terminate keep billing. Enforce a maximum lifetime and reap orphans automatically.
+-----------------+ webhook / +---------------------+
| GitHub Actions | queue poll | Autoscaler |
| [1] job queued |-------------->| [2] sees demand |
+-----------------+ | VM pool or K8s ctrl |
^ +---------------------+
| |
| [4] registers, | [3] provision VM/pod
| takes one job | from known image
| v
| +---------------------+ +--------------+
+-------------------------| Ephemeral runner |<--->| Remote cache |
| [5] runs ONE job | | same region: |
+---------------------+ | object store,|
| | pkg proxy, |
| [6] deregister | reg. mirror |
v +--------------+
+---------------------+
| [7] destroyed; |
| no state carried |
+---------------------+
Failure modes:
scale-up lag -> jobs wait at [1]; keep a small warm pool
stuck instance -> never registers [4] or never destroyed [7];
enforce max lifetime and reap orphans
Ephemeral runner lifecycle: a queued job triggers the autoscaler to provision a fresh VM or pod that registers, runs exactly one job against a co-located remote cache, deregisters, and is destroyed.
When should you avoid self-hosted runners?
The strongest reason to avoid self-hosting is security. A runner executes whatever the workflow tells it to, on your machines and inside your network. A persistent runner makes this worse because it keeps state between jobs: a cached credential, a modified toolchain, or a background process left by one job can still be there when the next one starts. For this reason, GitHub and most security guidance advise against using self-hosted runners for public repositories or for pull requests from forks. Anyone who can open a PR can then run code on your infrastructure.
If you self-host anyway, the hardening work is substantial:
- Network isolation. Put runners in a segment that can reach only what builds need, not production databases or internal admin APIs.
- Least-privilege credentials. Give runners short-lived, narrowly scoped tokens instead of instance roles that can touch your whole cloud account.
Operational burden is the second cost. Base images, OS patches, toolchain upgrades, autoscaler bugs, and capacity incidents all become your team's on-call work. A broken runner fleet stops every team's merges at once.
Portability also suffers. Once workflows depend on a custom image or private network access, they no longer run on hosted runners. Contributors can't reproduce them, and migrating away gets harder.
Finally, skip self-hosting for low-volume or bursty workloads. If builds cluster around a few busy hours, you either pay for idle capacity the rest of the day or accept cold-start queues. Either way, the per-minute savings largely disappear.
Who should self-host, and how do you run a hybrid setup?
Self-hosting pays off for teams with steady, high-volume CI or jobs that need something GitHub-hosted runners can't easily provide. Price per minute is only part of it:
- Private network access. A runner inside your VPC can reach internal registries, databases, and staging services without exposing them publicly or maintaining tunnels.
- Specialized hardware. You can provision GPU, ARM, or large-memory instances to match the job, rather than fitting the job to the available runner sizes.
- Warm, co-located caches. A persistent dependency or layer cache on local disk or in the same region skips repeated downloads, so the same job runs in fewer minutes.
- Data locality. When artifacts and images are stored in the same cloud region as the runner, pushes and pulls stay inside that region. This avoids egress charges and cuts transfer time.
The most practical setup is usually hybrid. Keep low-volume, bursty, and public-repo jobs on GitHub-hosted runners, where you pay nothing while they sit idle. Send heavy or hardware-specific jobs to self-hosted pools using runs-on labels, for example runs-on: [self-hosted, linux, gpu] or [self-hosted, linux, arm64]. Because routing is set per job, you can move a single workflow between pools without touching the others.
| Workload trait | Runner type |
|---|---|
| Public repo or untrusted PRs | GitHub-hosted |
| Low volume or bursty schedule | GitHub-hosted |
| High, steady volume | Self-hosted pool |
| Needs GPU, ARM, or large memory | Self-hosted pool |
| Reaches private network resources | Self-hosted pool |
| Large artifacts stored in your cloud region | Self-hosted pool |
Usage changes as teams and repos grow or shrink. Review the split each quarter against your measured minutes and pool utilization, and move workloads between runner types when the numbers no longer support their current placement.
name: ci
on:
push:
branches: [main]
pull_request:
jobs:
# Light, bursty work: stays on GitHub-hosted runners (no idle cost)
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: make lint
# High-volume build: routed to a self-hosted Linux pool with a warm local cache
build:
runs-on: [self-hosted, linux, x64]
# Skip PRs from forks so untrusted code never reaches self-hosted machines
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
steps:
- uses: actions/checkout@v4
- run: make build
# Hardware-specific job: only runners registered with the 'gpu' label pick this up
gpu-tests:
needs: build
runs-on: [self-hosted, linux, gpu]
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v4
- run: make test-gpu
# ARM build: native arm64 pool instead of emulation
build-arm64:
runs-on: [self-hosted, linux, arm64]
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v4
- run: make build ARCH=arm64
A single workflow that keeps lint on GitHub-hosted runners and uses runs-on labels to route builds, GPU tests and arm64 builds to self-hosted pools. Fork pull requests are kept off the self-hosted machines.
How OneEnv can help
Disclosure: OneEnv is the product behind this blog.
OneEnv (oneenv.io) is a workspace-based governance platform for the things services share — environment variables, database structure, API routes and validation rules. A change to a shared value is staged on a branch, reviewed once, and then every affected service explicitly approves or rejects it before it goes live, so you can see who a change touches before it ships instead of finding out in production.
Applied to self-hosted github runners cost, this is where it helps:
Saves time
- Every service that inherits a shared value is listed in one place, so nobody searches repos and chats to find out who is affected.
- One review per branch replaces coordinating each team separately; each service still keeps its own approve/reject.
- Reviewers see the exact diff and the list of affected services up front, so approval is a decision rather than an investigation.
Saves cost
- Fewer production incidents and rollbacks caused by a shared value, route or column changing under a consumer unannounced.
- Less duplicated configuration to maintain: one shared definition inherited by many services.
- Per-service approve/reject means a bad shared value can be refused where it would break something, before it is live.
- OneEnv has a free plan (1 workspace, unlimited services and members, full governance), so trying it costs nothing.
These are qualitative benefits, not measured results — how much you save depends on how many services share the value.
Want to try it? Start at oneenv.io.