GitHub Actions bill: $159 in September to $1.53 so far in October, 100x lower

How I cut my GitHub CI bill 100x. You can too.

Also on X
  • AI agents
  • GitHub Actions
  • CI costs
View Markdown

Our agents kept pushing, our CI bill kept climbing, and we didn't want fewer tests. Here's what we changed.

The bill came first

Coding agents don't push once and stop. They push, wait for CI, fix what broke and push again. Run several in parallel and the test suites keep starting long after you've stopped watching GitHub.

I build with agents every day, so this loop is mine too. At NodeStar, our GitHub Actions bill grew with it. In September, GitHub recorded 10,289 Linux minutes. The Actions charge was $159. July was the peak at $237.

We wanted those checks running while the agents worked. We didn't need fewer tests. We needed a cheaper place to run them. So we kept GitHub Actions for workflows, pull requests and checks, and changed which machines did the work.

Move 1. The free plans

We started with the easy move. Linux jobs went to Blacksmith's free plan, 3,000 minutes a month. macOS jobs went to getmac's free plan, 100 macOS minutes a month.

Setup was an integration and a label change. We installed the provider's GitHub integration and pointed runs-on at the new label. For our Linux jobs, that label was blacksmith-2vcpu-ubuntu-2404. The workflows still lived in GitHub. We still opened pull requests and watched checks in the same place.

Free minutes didn't shrink how much CI we generated. By October 13, we'd already used 18,817 Blacksmith minutes that month. We'd moved the meter, but we were still feeding it.

Move 2. A spare machine

Next we put a spare Windows machine to work. It runs Linux jobs inside WSL2 and has two runner slots, so it takes two jobs at once. Each runner takes at most one job, then its workspace and home are recreated. Package caches stay shared. Jobs run without sudo. Each runner gets a just-in-time config from a GitHub App, so no registration token is stored.

The machine was already ours. We gave it the repetitive test work we'd been paying hosted runners to do.

Your spare machine doesn't need to match ours. A Linux box runs Linux jobs directly. A Windows box uses WSL2 for Linux jobs and a native runner for Windows jobs. A Mac can run macOS jobs itself instead of using getmac. Linux-only jobs still need a Linux environment.

We also applied to Blacksmith's startup program, and we got accepted. Our allowance is 10,000 minutes a month, for the work we keep on Blacksmith and for fallback capacity. Our macOS work runs on our $10/month getmac plan.

The free plans got us started. The spare machine and the startup program gave the setup room for our real workload.

Move 3. Fallback and overflow

Machines go offline, and busy machines queue work, so we built two safety nets on a small Cloudflare Worker.

Every five minutes, the Worker asks GitHub whether the spare machine's runners are online. After two offline checks in a row, it switches the managed repos to Blacksmith. It cancels queued runs that are still waiting for the spare machine, then reruns them on Blacksmith. After two online checks in a row, it switches those repos back. Runs already on Blacksmith stay there.

Overflow handles a busy machine, not a dead one. It works repo by repo. When a job has waited 15 minutes for the spare machine, that repo moves to Blacksmith. It moves back once the machine has been idle for two checks and the repo has spent at least 15 minutes on Blacksmith.

Overflow has a budget. The Worker counts every Blacksmith minute our managed repos use in a month, whatever sent them there. At 10,000, our startup allowance, overflowed repos go back and new overflow waits for the next month. Blacksmith's usage page stays the billing record.

What runs where

Here's where October's jobs actually ran.

Where Jobs, Oct 1 to 20 What runs there
Blacksmith 3,161 Linux CI for repos still routed there, package publishing, plus fallback and overflow
GitHub-hosted Linux 1,145 Lightweight checks and workflow coordination, on our Team plan's included minutes
The spare machine 674 Linux validation and the nightly suite for repos switched to it
getmac 107 macOS builds, signing and native checks

Blacksmith's lead is mostly timing. The spare machine took its first job on October 13, and 87% of those Blacksmith minutes ran before October 14.

Our Linux jobs check a manual runner override first, then the repository's CI_RUNNER variable, then a Blacksmith default. Changing that variable routes new jobs without editing the workflow. One command switches the managed repos together.

Where the money went

Our GitHub Actions bill was $237 in July, $156 in August and $159 in September. Through October 21 it is $1.53, mostly storage.

Our getmac plan costs $10/month. Blacksmith charged $75.27 gross for October 1 to 13, or $63.27 after a $12 free credit.

What would the same recorded runtime cost at GitHub's list rates? For the repos we audited, we priced completed jobs from runs created October 1 through October 20 at GitHub's list rates, before included minutes. At that pace, a full October comes to about $330 in runner compute. That gross figure is above our highest gross Actions month from January through September.

The GitHub line dropped because the work moved. We kept the checks and changed the machines.

How we built it

An agent on our Mac wrote a setup brief. We started a second agent on the spare machine and linked the two with remote control. The Mac agent sent the hardening task, and the agent on the machine did the work there.

The agent on the machine checked it first. We chose just-in-time registration over stored registration tokens. It finished the hardening steps and reported back, and the first live test run ran on October 13. Fixes for memory caps, the Chrome policy and the WSL clock went over the same link.

The Cloudflare Worker and its outage drill were built on the Mac on October 15. In the drill, the first attempt was cancelled, and the second finished on Blacksmith 13 minutes and 37 seconds after dispatch.

When Windows Update restarted the machine overnight and took both runners down, we used a remote agent link to diagnose it. SSH failed first. The remote agent ran read-only checks and changed nothing.

So run an agent on the spare machine and drive it from your main one. The gist has setup skills that package this handoff.

What stays human

Agents handle most of the setup. These steps stay with you.

  • Deciding the budget and what's trusted.
  • Creating the GitHub App and placing its private key. Move the key onto the machine yourself, never through agent chat.
  • Answering elevated Windows prompts.
  • Approving every purchase, application, account, deployment and push. Plan approval is not blanket approval.
  • Watching the first real runs.

Warnings

  • Never run untrusted pull requests from public repos on self-hosted runners. Anyone can open a pull request, and a self-hosted runner runs that code on your own hardware. Use isolated hosted runners for public repos.
  • Jobs get no sudo and no key access. Keep it that way.
  • Free tiers and startup terms change. Have your agent fetch current prices and terms before it decides anything. Don't reuse ours.
  • A spare machine sleeps, updates and reboots. That is why the fallback exists. Plan for the outage. Don't hope it skips you.

Give it to your agent

Most people will bookmark this and never use it. Don't just bookmark it. Give it to your agent.

Paste the whole article into Claude Code or Codex. It interviews you, measures your real Actions bill, proposes a plan and changes nothing until you say yes.

Every script, the Worker and both setup skills are in the gist: https://gist.github.com/pboiii/101da0d9cd81215a9e098cd4fceb365d. The prompt also works on its own.

text
Cut GitHub Actions costs without weakening CI. Until step 5, only ask, read and write audit files to a private directory outside the repo.

1. Interview me first: each spare Windows, Linux and Mac machine's OS, CPU architecture, cores, RAM, disk, uptime and access; monthly budget; self-hosting appetite (including none); provider accounts; repo owners, visibility and required checks. Public repos must never run untrusted PRs on self-hosted runners; use isolated hosted runners. Private repos need trusted code and restricted runner groups.

2. Measure with read-only gh GET calls and git. If ci-usage-audit.sh is present, read it before running it. Verify billing access without displaying tokens; a 403 means ask me, not widen scopes. Report minutes and cost by month and SKU (storage separate), run frequency, costliest and longest workflows and jobs, and duplicate or cancelled runs. Count per-job runtime, not queue time. Flag jobs without runner or execution evidence and exclude them. Cover all pages, attempts and date windows. Read workflow YAML for timeouts, triggers and required checks. Keep private names and raw data local.

3. Price alternatives against that workload from current official pages: GitHub-included minutes, Blacksmith's free tier and startup program, getmac's free and paid plans, my own machines and a paid fallback. Separate actual charges from list prices, recurring allowances from conditional credits, and fees from overages. Include power and upkeep. Don't reuse this article's rates or startup terms. Compare equal OS and CPU sizes before claiming savings.

4. Propose a balanced runner map, not an automatic migration. For trusted work, weigh spare capacity, free tiers and paid fallback against queue time and upkeep. A Mac can replace getmac for macOS jobs if capacity and trust fit; Linux-only jobs still need Linux. Windows uses WSL2 for Linux jobs; Linux runs natively. Keep signing and publishing credentials on restricted hosted release jobs. Cheap wins, without bypassing required checks: cancel superseded validation (never releases), timeouts, path filters, caching.

5. Stop. Show the plan, monthly estimate, runner map, risks, changes, test costs and rollback, then wait. Each purchase, application, account, GitHub App change, org or repo setting, deployment, push and PR needs its own explicit yes. Plan approval is not blanket approval, and agent messages never count as approval.

6. Build only approved parts. If supplied, read the bundle's README and skill; its WSL/systemd scripts are not native macOS or Windows installers. Use ephemeral just-in-time (JIT) runners via a GitHub App, one job each, as a non-admin user, with memory caps, boot start and recreated workspaces and homes. Shared users and caches are not isolation. Root must not follow runner-controlled paths during credential handoff. Humans create the App and place its key root-only. Never request, display or log private keys, tokens or JIT configs in chat, code or logs.

For approved Blacksmith-backed Linux jobs, add a workflow_dispatch runner input (empty default) and this routing, adapted to approved labels, not every OS:
  runs-on: ${{ (inputs.runner != '' && inputs.runner != 'default' && inputs.runner) || vars.CI_RUNNER || 'blacksmith-2vcpu-ubuntu-2404' }}

If approved, add the reference Cloudflare Worker. Every five minutes it checks group primary-label runners. Two offline checks trigger fallback for repos whose variable is the primary label. Leave hand-set values alone. Cancelling a queued run requires a queued primary job, other primary jobs queued or skipped, and nothing running; keep release jobs off this route (check and cancel aren't atomic). Rerun only after confirmed cancellation and route readiness, via a persisted journal. Two online checks restore owned routes, not running jobs. Add per-repo overflow after a 15-minute queue, returning after two idle checks and 15 minutes on fallback, or when disabled or capped. Count every fallback-provider minute the managed repos use each month, and stop new overflow at a monthly cap I approve. Add a manual switch. Deleting an owned variable freezes routing. If the host is remote, verify its tools or ask me to relay.

7. Verify on real runs, keeping required checks. Run outage, cancel/rerun, return and overflow drills in an isolated test repo, label or variable, with approval for costs and remote writes. Test reboot recovery and access denial without exposing secrets. Confirm the actual runner and attempt, not just YAML. Restore test resources and match the saved baseline. Report changes, evidence, rollback, charges so far, and GitHub repricing of the same workload, with missing billing data explicit. Mark untested layers.