TL;DR
Self-hosted GitHub Actions runners can be persistently compromised by untrusted code. Ephemeral runners, JIT registration, and ARC scale sets fix that.
Self-hosted runners are the cheapest way to run GitHub Actions at scale — and the easiest way to hand an attacker the keys to your infrastructure. The same machine that builds your code also holds your secrets, your cloud credentials, and your network access, and any workflow that runs on it can reach all three. The fix is not to stop self-hosting. It is to make every runner disposable: one job, then destroyed, so there is nothing left to compromise.
The short version: never run a persistent self-hosted runner on a public repository, and think twice before running one on a private repository that accepts pull requests from forks. Register runners just-in-time, run each one for a single job, and destroy it afterwards. If you run Kubernetes, Actions Runner Controller (ARC) does this for you with runner scale sets that scale to zero. If you do not, ephemeral VMs with JIT registration get you most of the way there. The bill decides the rest: GitHub-hosted runners cost $0.006 per minute, self-hosted runners currently carry no GitHub fee at all, and the break-even is a question of utilization, not sticker price.
Why self-hosted runners are a security decision first
GitHub-hosted runners execute code inside ephemeral, clean, isolated virtual machines — every job starts from a fresh image, and nothing a job does can persist to the next one. Self-hosted runners have no such guarantee. GitHub's own hardening guide states it plainly: self-hosted runners "can be persistently compromised by untrusted code in a workflow," and as a result they "should almost never be used for public repositories," because anyone can open a pull request and compromise the environment.
The risk is not theoretical. A workflow job runs arbitrary code — the code in the pull request, the actions it calls, and every dependency those actions pull in. On a self-hosted runner that code runs with the runner's network access and can read whatever the runner can read: secrets passed as command-line arguments (visible to another job on the same machine through ps), the GITHUB_TOKEN, cloud credentials on disk, and internal services reachable from the runner's network. GitHub's guide is explicit that even environments and required reviewers do not fix this: the workflow is still not running in an isolated environment.
That is the whole case for ephemeral runners. If a runner only ever runs one job and is destroyed afterwards, a compromised job has nowhere to persist to and nothing to come back for. The runner's lifetime becomes the blast radius, and you control the lifetime.
The options
Option 1: Persistent self-hosted runners
The classic setup: install the runner agent on a VM or a bare-metal box, register it once with a long-lived token, and let it pick up job after job. It is simple, it is fast (warm caches, warm Docker layers), and it is the configuration GitHub's own documentation warns about most strongly.
Pick this only when the runner is truly private — a single repository, no forks, no pull requests from outside the team, no untrusted code of any kind — and even then, treat the machine as a shared secret store. Keep sensitive material off it, restrict its network access to the minimum (no cloud metadata endpoints, no internal admin services), and put it in its own runner group so a compromise in one repository cannot reach runners shared with others. GitHub's guide recommends runner groups exactly for this: when runners are defined at the organization or enterprise level, workflows from multiple repositories can land on the same machine, and a compromise spreads with them.
The honest assessment: this option survives on trust that no untrusted code will ever run on the machine. The moment a repository accepts outside contributions, that trust is gone. Most teams that start here should be planning their exit from it.
Option 2: Ephemeral VMs with just-in-time registration
The middle path, and the one GitHub itself recommends for registration security: create the runner through the REST API as a just-in-time (JIT) runner, which performs at most one job before being automatically removed, and run it on a VM that is destroyed after the job finishes. The flow is short:
# Request a JIT config from the API (one config, one runner, one job)
curl -X POST -H "Authorization: Bearer $TOKEN" \
https://api.github.com/orgs/acme/actions/runners/generate-jitconfig \
-d '{"name": "runner-1", "runner_group_id": 1, "labels": ["ephemeral"]}'
# Start the runner with the encoded config it returns
./run.sh --jitconfig ${encoded_jit_config}Your automation wraps this in a lifecycle: provision a fresh VM from a clean image, register it with the JIT config, let it run its single job, then delete the VM — whether the job succeeded or not. Cloud-init, Packer images, or a small controller script can drive the whole loop. The registration token is single-use, so there is no long-lived credential to steal from the machine, and the machine itself is gone before the next job arrives.
Two caveats from GitHub's own notes. First, reusing hardware to host JIT runners can still expose information from the environment — the JIT token fixes registration, not the disk. Use automation to guarantee the runner starts from a clean environment every time; a JIT runner on a reused, dirty VM is the worst of both worlds. Second, destroying a VM per job costs time: image boot, runner registration, and cache warm-up add a minute or two to every job. That is the price of the isolation, and for most teams it is cheaper than the alternative.
Pick this when you already run VMs in a cloud account, your job volume is steady enough that per-job boot time does not dominate, and you want the security win without adopting Kubernetes.
Option 3: ARC runner scale sets on Kubernetes
Actions Runner Controller (ARC) is GitHub's Kubernetes operator for self-hosted runners, and it is the cleanest implementation of the ephemeral model. You install two Helm charts — one controller per cluster, one scale set per pool of runners — and ARC does the lifecycle for you: a listener pod holds a long-poll connection to GitHub, and when a job arrives it asks the controller to create that many runner pods. Each pod registers with a just-in-time token, runs exactly one job, and is deleted. When no jobs are waiting, the scale set scales to zero.
# A runner scale set that starts at zero and grows with demand. # Install once per pool; the listener creates one pod per waiting job. githubConfigUrl: "https://github.com/acme" githubConfigSecret: "arc-github-app" minRunners: 0 maxRunners: 20 containerMode: type: "dind" # Docker-in-Docker, for jobs that run docker build
ARC's scale-set mode is the current, supported way to run it — the older autoscaling modes are community-maintained legacy. Authenticate with a GitHub App rather than a personal access token for repository and organization scale sets, pin the chart version (recent guides pin the 0.15.x line, released October 2026), and keep the controller and the scale sets on the same version. Two modes matter in practice: Docker-in-Docker, which runs a Docker daemon as a sidecar for jobs that build images or use services:, and Kubernetes container mode, which runs each step in its own container. Start with Docker-in-Docker unless your jobs are already container-native.
Pick this when you already operate a Kubernetes cluster, your job volume is bursty (scale-to-zero is where ARC pays for itself), or you want per-team runner pools with their own labels and limits. Do not adopt Kubernetes just for ARC — if you have no cluster, Option 2 is cheaper in every sense.
Option 4: Managed runner vendors
A newer category: vendors that run ephemeral, high-performance runners for you — Blacksmith, Depot, Namespace, and others — behind a single runs-on: label change. You get warm caches, larger machines, and per-job isolation without operating the fleet. The trade is the obvious one: you are paying per minute again (roughly $0.003–$0.006 per minute for a 2 vCPU runner, depending on vendor and plan, as reported in November 2026 pricing comparisons), and you are trusting a vendor's isolation instead of your own.
Pick this when self-hosting would cost more in engineering time than the per-minute premium, or when you need hardware GitHub does not sell — large-memory builds, fast disks, GPUs. It is the right answer for teams whose bottleneck is build speed, not build cost.
Option 5: Stay on GitHub-hosted runners
The option nobody writes a migration plan for, because there is nothing to migrate. GitHub-hosted runners are ephemeral by default, maintained by GitHub, and billed per minute with no fleet to operate. Since 1 January 2026 the standard Linux runner costs $0.006 per minute, after GitHub cut hosted prices by up to 39% — and the $0.002 per minute platform charge on self-hosted usage that GitHub announced for March 2026 was postponed before it took effect and has not been rescheduled, so self-hosted runners still carry no GitHub fee today.
Pick this when your jobs need nothing private: no VPC access, no special hardware, no giant caches. It is also the only correct answer for public repositories. The cost argument for self-hosting only wins when utilization is high enough — see the trade-offs below — and for many teams it never is.
The comparison
| Option | Isolation per job | Ops burden | GitHub fee | Best for |
|---|---|---|---|---|
| Persistent self-hosted | None — state survives | Low — install once | $0 today | Fully private repos, no outside PRs |
| Ephemeral VMs + JIT | Full — VM destroyed | Medium — lifecycle automation | $0 today | Cloud teams with steady volume |
| ARC scale sets | Full — pod per job | Medium — Kubernetes operator | $0 today | K8s teams, bursty load, scale-to-zero |
| Managed runners | Full — vendor's problem | Low — one label change | ~$0.003–0.006/min | Speed over cost, special hardware |
| GitHub-hosted | Full — fresh VM per job | None | $0.006/min | Everything else, and all public repos |
Trade-offs
Cost is a utilization question, not a price question. A GitHub-hosted standard Linux runner costs $0.006 per minute — $0.36 per hour of job time, billed only while a job runs. A 4 vCPU on-demand VM costs roughly $0.003 per minute while it exists, whether or not a job is running. So a self-hosted VM beats hosted pricing only while it is busy more than about half the time; an idle VM is pure loss, and the engineer keeping the fleet patched is the line item nobody puts in the spreadsheet. Worked example: 10,000 job-minutes a month costs $60 on GitHub-hosted runners. One always-on 4 vCPU VM at roughly $0.18 an hour costs about $130 a month before a single job runs — it only wins once the fleet is busy enough to spread that fixed cost across more than ~20,000 job-minutes. Scale-to-zero is what makes ARC and ephemeral VMs win: you pay for the machine only while a job is on it.
The $0.002 charge is a risk, not a cost. GitHub announced a $0.002 per minute cloud platform charge on self-hosted usage in December 2025, then postponed it the next day "to take time to re-evaluate our approach." It has not returned, and billing documentation still lists self-hosted usage as free. Budget on zero, but know the drafted number: at $0.002 a minute, 100,000 self-hosted minutes a month would have carried $200 before any infrastructure was paid for. If it ever lands, every break-even above moves by a third.
Boot time is the hidden tax on ephemeral. A fresh VM or pod per job means image pull, runner registration, and cold caches on every run. Measure it: if your jobs are two-minute tests, a ninety-second boot doubles your wall-clock time. Mitigate with pre-baked images, warm image caches on the nodes, and ARC's minRunners setting — a small number of idle, pre-warmed runners for latency-sensitive jobs, with the bulk of the pool scaling from zero.
Secrets hygiene still matters. Ephemeral runners remove persistence, not exposure. A job can still exfiltrate a secret it was given while it runs. Keep using short-lived credentials — OIDC federation to your cloud provider instead of long-lived keys — scope the GITHUB_TOKEN to read-only by default, and never pass secrets as command-line arguments, where another process on the same machine can read them from ps.
Recommendation
For most teams, the decision is a flowchart with one question: do your jobs need your network, your hardware, or your cache? If the answer is no, stay on GitHub-hosted runners — you are paying $0.006 a minute for isolation you would have to build yourself. If the answer is yes and you run Kubernetes, adopt ARC runner scale sets with scale-to-zero and a GitHub App for authentication; it is the only option where the secure configuration is also the default configuration. If the answer is yes and you do not run Kubernetes, build the ephemeral-VM loop with JIT registration and automated destruction — and measure your utilization monthly, because the moment it drops below half, hosted runners are cheaper again.
Whatever you choose, retire persistent runners from any repository that accepts pull requests from outside your team. That is not a performance decision or a cost decision. GitHub's own documentation calls it a security decision, and it is the one line in this article that is not a matter of opinion.
When not to self-host
Do not self-host for a public repository. GitHub's guidance is unambiguous, and the attack is trivial: open a pull request, wait for the workflow to run your code on the runner, take what is on the machine.
Do not self-host to save money you have not measured. Pull your last three months of Actions minutes, multiply by $0.006, and compare against the real cost of the fleet — instances, storage, and the hours someone spends keeping it running. If the saving is under a few hundred dollars a month, the fleet is a hobby, not an optimization.
Do not self-host when the jobs are short and latency-sensitive. Per-job boot time on ephemeral runners punishes two-minute jobs hardest, and a persistent runner bought back with that latency is exactly the machine you were trying to retire.
And do not adopt Kubernetes for ARC alone. A cluster is a platform commitment — upgrades, networking, storage, on-call. If you have no other reason to run Kubernetes, the ephemeral-VM loop on the cloud you already use is the smaller, safer build.
What to do next
This week, audit where your jobs actually run. List every repository using runs-on: self-hosted, note which of them accept outside pull requests, and check whether any of those runners are persistent. The ones on public repositories move to GitHub-hosted runners immediately — that is a one-line change per workflow and the highest-value line in this article.
Then pick one repository with steady, private volume and pilot the ephemeral loop on it: JIT registration, one job per runner, automated destruction, and a dashboard showing queue time and cost per job. If the pilot's numbers hold for a month, roll it out; if boot time or utilization kills the economics, you have learned that with one repository instead of a fleet. Our GitHub Actions CI/CD guide covers the workflow side of the setup, and the secure CI/CD pipelines guide covers the token scoping and secret handling that ephemeral runners still depend on — start there if your workflows still pass secrets on the command line.
Why This Matters
Understanding the business and technical context helps you make informed decisions rather than blindly following patterns.
Trade-offs to Consider
Every architectural decision involves trade-offs. Consider your specific requirements, team expertise, and scale when evaluating options.
When NOT to Use This
Knowing when a solution doesn't apply is as valuable as knowing when it does. Consider alternatives for your specific situation.
Decision Framework
Use this framework to evaluate whether this approach is right for your use case based on your specific constraints and requirements.