Moving off GitHub Actions (staying on GitHub)
Ben Guo ·
I started building more closed-source projects with agents, and my CI costs started to grow out of control. GitHub Actions is free for public repos. Private repos pay by the minute, and agents open a lot of pull requests.
- pull requests
- 1,541
- CI runs
- 10,504
- private repos
- 40
My worst day cost $216, mostly in Mac minutes.
A lot of ink has been spilled about how GitHub is bad and unreliable. I wasn't ready to move off GitHub entirely, but I realized I could move off GitHub Actions quite easily. The code, the pull requests and the required checks all stay on GitHub. What changes is one line in each workflow:
- runs-on: macos-26+ runs-on: [self-hosted, laptop]
- runs-on: ubuntu-24.04+ runs-on: [self-hosted, cloudflare]First, run less
Before moving anything, make the jobs you already have run less often. It's free.
- Use path filters, so a docs change doesn't build the Mac app.
- Skip the tests on main when the exact same code already passed on its pull request.
- Set
concurrencywithcancel-in-progress, so a new push cancels the run it replaces.
Mac: a spare laptop
Mac CI is obscenely expensive. On GitHub, a minute of Mac costs ten times a minute of Linux.
What one minute costs on GitHub
- Linux0.6¢
- Mac6.2¢
And most of what I build is Mac apps. Yaptake edits video with a transcript. Textmock makes iMessage mockups. Sponge keeps your reading close. OH supervises Claude Code and Codex sessions. DAWN composes music in TypeScript and has a desktop app. Their builds and tests need a Mac, and some need a real, logged-in desktop.
So first I set up a spare laptop as a self-hosted runner, an M4 Max MacBook Pro that wasn't doing much. It turned out to be faster than GitHub's Mac runners, too:
One build of Yaptake's app
- GitHub's Mac runner16½ min
- My spare laptop3½ min
The setup:
- Make a second macOS user for the runner and leave it logged in. A separate user keeps CI out of your files, and the login gives app tests a desktop, which a background service doesn't get.
- Install what the jobs need. For me that's Xcode, Rust, Bun and Node.
- In your org's Actions settings, make a runner group that only private repos can use. On a public repo, a stranger's pull request could run code on your laptop.
- As the runner user, download the runner, register it to that group with a label, and install it as a login service.
- Change
runs-onto that label.
./config.sh --url https://github.com/YOUR-ORG --token TOKEN \
--runnergroup mac --labels laptop
./svc.sh install && ./svc.sh startAfter the first day I added two things. Each workflow starts with a five-second job on the laptop that fails fast if it's logged out or offline, so runs don't sit in the queue forever. And jobs clean up after themselves, because the laptop keeps whatever the last job left behind. That includes the build cache, which helps.
Last week it ran about 900 builds. The catch is that one laptop runs one job at a time, so when agents push six branches at once, Mac jobs wait their turn. I've seen one wait half an hour.
Linux: Cloudflare
Then I looked at the bill for Linux Actions, and realized I could find much cheaper compute. My Linux jobs are small and there are lots of them: type checks, test shards, site builds, about a minute and a half each, often forty at once. Every project has some, and yiii, which teaches Mandarin and Spanish, needs nothing else.
Here's what the same jobs would cost elsewhere, for every dollar they cost on GitHub:
$1 of GitHub's Linux minutes, elsewhere
- GitHub$1.00
- WarpBuild67¢
- Blacksmith66¢
- Namespace38¢
- Cloudflare Containers37¢
- RunsOn on AWS spot24¢
- Ubicloud20¢
- Hetzner, your own servers19¢
Cloudflare seemed like the most reasonable option, even though it isn't the cheapest. If all you want is a smaller bill, look at Ubicloud or run your own Hetzner servers. I already use Cloudflare for a number of other things (love R2 and D1), so it was an easy switch: no new account, no servers, billing by the second, and nothing running when nobody pushes.
Cloudflare doesn't sell CI runners. It sells Containers, and a runner takes four pieces:
- A GitHub App on your org, allowed to manage its self-hosted runners, sends a
workflow_jobwebhook to a Worker whenever a job is queued. - If the job asks for your label, a Durable Object starts a fresh container (mine are 4 vCPU, 5 GiB of memory, 20 GB of disk) and asks GitHub for a just-in-time runner, good for one job.
- The container runs GitHub's stock runner, does that job and exits. Nothing carries over between jobs.
- Every 30 seconds the Durable Object checks GitHub's queue against what's running, to catch missed webhooks and stuck containers.
It needs the Workers Paid plan ($5 a month), one wrangler deploy for the Worker and the container image, and another private-only runner group. I tried it on one repo for a day and moved the rest over the next two. Jobs start about 15 seconds after they're queued.
The trade-offs
- Cloudflare can restart a container mid-job. That's fine for short jobs. I wouldn't run an hour-long build there.
- Containers are x64 only. My ARM builds run in a small VM on the laptop.
- Now and then a container is slow. I raised one timeout and moved a performance test to the laptop.
- npm's trusted publishing only works from GitHub's own runners, so publish jobs stay there. So do public repos, where the minutes are free.
- The laptop is a laptop. If it reboots, someone has to log in.
The result
GitHub billed me nothing for Actions on November 21, 22 or 23. Linux jobs cost a bit over a third of what they did, and Mac jobs cost nothing but a laptop I already had. If GitHub brings back the fee for self-hosted runners it proposed last year, a little of that comes back.
GitHub still has the code, the pull requests and the green checkmarks. It just doesn't get paid by the minute for them.