skip to content
Succeeded With Errors

Orrery 2: The Day I Burned 1,239 CI Minutes

/ 11 min read

Table of Contents

On the afternoon of the twenty-seventh, GitHub sent me an email. Not a failed build, not a security alert. A polite note saying I was almost out of Actions minutes for the month.

I had never once looked at the usage page. I looked at it then. The number for that day alone was 1,239.

That’s minutes. The free plan gives a private repository 2,000 a month, and it was the twenty-seventh, so I’d burned most of a month’s allowance before dinner on a single day.

I did the arithmetic standing up. Then I sat down, paused every deploy, and spent the next hour taking the pipeline apart. This is the second post in the Orrery series, and it’s the one where the “errors” half of the blog name gets its turn.

What I Had Built

Context, briefly: the previous post covered how a Starfinder campaign app named MercNet grew a platform underneath it. The relevant detail here is how fast it was growing. At the time of the usage-page moment, the repo was five days old and had taken a hundred pull requests. An AI agent team was doing the typing: one orchestrator planning the work, several builders in parallel, each in its own worktree, each opening a PR when its unit was done. I’ll write that whole workflow up properly. For now the only thing that matters is the PR count, because the pipeline cost scales with it.

When I set up continuous integration on day four, I went hard. I’d been burned before by “we’ll add tests later”, and I was letting agents write most of the code, so I wanted a gate I could trust more than I trusted any individual diff. The first pipeline was one job that did everything, in order: typecheck all three workspaces, run the server test suite, build the web client, install Chromium, and run the full Playwright end-to-end suite against a throwaway server. About seventeen minutes, start to finish. Every pull request paid it. So did every push to main.

I also wrote my own merge workflow. The repository is private and on the free plan, where branch protection and GitHub’s built-in auto-merge weren’t available, so a scheduled workflow became the gate: find open PRs with an automerge label, check for a green CI run on the exact head commit, merge if so. If the branch had fallen behind main, update it and re-dispatch CI, because pushes made with the workflow’s own token don’t trigger workflows on their own. That last clause is important and I’ll come back to it.

Then the battle map happened. Nine rounds of tactical-map features in three days, each round a feature branch, each feature a batch of units, each unit a PR into the feature branch. The repo’s own testing guide, which I had written, says this about end-to-end tests:

Specs are table-critical flows only: sign in, GM console loads apps, player device loads, a reveal reaches the player live, billboard renders signed out. Keep each under 30 seconds. Do not test every module here.

There are forty-three Playwright specs in the repo. Thirty-nine of them are battle-map specs. Every battle-map unit shipped its own, because every unit brief said to prove the behavior and a Playwright spec is the most convincing proof there is. The guide said one thing. The briefs said another. The briefs won, and I wrote both of them.

The Arithmetic

Here is what each pull request actually cost by the twenty-seventh.

The pipeline triggered on pull_request and on push to the branches I cared about. For a unit PR into a feature branch, that was two seventeen-minute runs for one commit. If the branch was behind its base when the merge workflow got to it, update-branch plus a re-dispatched run made three. Call it fifty billed minutes per PR. Twenty-odd PRs on a busy day, and there’s your 1,239.

A feature branch sitting between the units and main should have been a buffer. It wasn’t. Unit PRs into the feature branch ran the entire suite, Playwright included, even though nothing could reach a player until the feature branch itself merged to main. Every unit paid the full price for a gate that only mattered at one point.

When I audited the workflows that afternoon, the cost turned out to be the least of it:

  • Nothing actually gated main. The branch rules on main had an empty required-checks list. The merge workflow accepted any green run on the head, which is a convention, not a rule.
  • Documentation-only merges released and deployed. Fixing a typo in a doc built a Docker image, pushed it to the registry, and swapped it onto the live server.
  • The release workflow interpolated commit messages straight into a shell script. Anyone who could land a commit message could run a command on the runner. The only person who could land a commit message was me, and my agents, but that’s a sentence I’d rather not have to say.
  • Main’s copy of the release workflow had no branch guard. A unit merged into a newly created feature branch could have deployed that branch to the live table.
  • The Actions cache was over its ten-gigabyte limit: 198 entries, eleven gigabytes, because the image build cached every layer with mode=max.

None of those were cost problems. I found all of them because of a cost problem. I’d have found them eventually, and “eventually” is the word I’d have been explaining to my players.

What It Looks Like Now

The fix is a two-tier pipeline, where the tier is chosen by what the PR is targeting.

A PR into a feature branch runs the quick tier: typecheck plus the web build, and the server test suite split into two parallel shards. About five minutes of wall clock, thirteen billed. No Playwright, no docs gate. A unit can’t reach a player from there, so it doesn’t pay for the player-facing proof.

A PR into main runs the full gate: the quick tier, plus the Playwright suite split into two shards, plus a docs check that fails the PR if the changelog, the module’s doc, or the architecture page didn’t change alongside code that should have changed them. First measured run: just under nine minutes of wall clock, thirty-two billed. The two Playwright shards are the long poles, about eight minutes each, and roughly two and a half of those are installing dependencies, building the client, and fetching Chromium before a single spec runs.

A few more pieces, each of which fixed one of the audit findings:

  • A tiny first job classifies the files in the PR. Documentation-only PRs skip every code job entirely.
  • The release workflow looks at what changed since the last tag. Only docs, tests, or CI files? No build, no image, no deploy. It also runs only on main now, and commit messages reach the shell through environment variables, never through template interpolation.
  • The merge workflow is base-aware: squash into a feature branch, merge commit into main, and it dispatches a preview deploy for a feature branch instead of a release.
  • Branch rulesets on main and on feature branches require a pull request and one named check. That check is the point of the next section.
  • Cache mode went from max to min, and I pruned the eleven gigabytes by hand.

The budget now: a unit PR costs about twelve billed minutes, a feature’s gate into main about twenty-three, a release and deploy about ten. An eight-unit feature with preview deploys comes to roughly 255 minutes. A realistic month is around 1,400 of the 2,000, with headroom for Dependabot. I’ll take it, and the next thing I cut is the e2e setup time: three shards instead of two, or a faster map suite, would get the gate down to about six minutes.

The whole restructure took about an hour of wall clock. Four builders worked the units in parallel while deploys were paused, and the one step an agent couldn’t do was applying the branch rulesets: the desktop app’s permission classifier refused the API call on the grounds that it looked like a CI bypass. Which, from a certain angle, it was. I ran the two commands by hand.

The Things That Bit Me

These are the specifics, and they’re the part I’d want someone to have told me.

One required check that always runs. The ruleset on main requires a single check named ci-ok. It’s a final job that depends on every other job, runs with if: always(), and decides green or red based on what the tier needed. The reason it has to always run: a docs-only PR skips all the code jobs, and a skipped job never reports a check. Without a check that always reports, a strict ruleset blocks that PR forever. For the same reason, never put a paths: filter on the workflow trigger. A filtered-out PR produces no run, no check, and no way to merge.

Check names are the job’s name:, nothing else. Matrix legs show up as tests (1/2). If I rename the ci-ok job, main waits for a check that will never report, and the error message does not say that. Before changing a ruleset I list the real names from a recent commit’s check runs and copy them.

Pushes made by the workflow token start no workflows. When the merge workflow updates a branch, GitHub does not run CI on the result. So the workflow re-dispatches CI itself, with the PR’s base as an input, and the dispatched run and the PR’s own run share a concurrency key so the stale one gets cancelled. Same reason the merge workflow explicitly dispatches the release and preview workflows after a merge: a merge it performs would otherwise trigger nothing.

The bot’s own pull_request run is held for approval. After an update-branch by the Actions bot, GitHub holds that run and the PR’s checks stay empty. The dispatched run on the same commit is what counts. Never approve the held run or merge by hand around it.

npm test -- --shard=1/2 doesn’t shard. npm swallows the flag. Call the test runner directly.

ubuntu-latest moved to 26.04 in October, and Playwright couldn’t install Chromium on it yet. The runners are pinned to 24.04 with a comment explaining why, because a pin without a reason gets removed by the next person who thinks they’re tidying.

Billed minutes and wall-clock minutes are different numbers, and you choose which one to optimize. Splitting into shards made the full gate more expensive in billed minutes (thirty-two versus seventeen) and much faster in wall clock. I chose wall clock for the gate into main, because that’s where a human, or an orchestrator, is waiting. I chose billed minutes everywhere else by not running what the merge didn’t need.

What I’d Take From This

Tier your pipeline by what the merge can reach. A unit landing on a feature branch can’t hurt a player. It doesn’t need the player-facing proof. The gate belongs where the blast radius is.

Read your own testing guide once a week. Mine said “smoke only” and the repo had forty map specs because every brief asked for proof. The guide was right. The briefs were also right. The resolution wasn’t to delete specs; it was to stop running them where they proved nothing.

A cost spike is a free audit. The 1,239 minutes were annoying. The empty required-checks list and the shell interpolation were dangerous, and the only reason I read the workflows closely enough to find them was that the bill made me.

Write the gotchas down next to the code. Every one of the items above is now a comment in the workflow file or a line in the workflow doc, because the next time one of them bites it’ll be an agent reading the file, not me, and the agent will not remember this afternoon.

Know the limits of your free plan before you lean on it. Note to self as much as to anyone. I built a pipeline that assumed minutes were free and found out the actual number from a warning email. The number was on a page the whole time.

The pipeline is green. The e2e shards are still eight minutes each, and I haven’t yet watched the strict update-branch path run under the new ruleset, which is the one risk I flagged in the plan and couldn’t test until it happens. The usage page is bookmarked now. Succeeded with errors.


Next in the series: the three contracts that let one map engine run two different games.