This guide covers practical optimizations for GitHub Actions billing: gating expensive jobs, consolidating cross-platform steps to Linux, and when to consider self-hosted runners. Small workflow changes can have an outsized impact on your monthly invoice.
Scenario 1 — iOS (macOS) CI: expensive per-minute runners
Problem: your iOS team runs a macOS job for every push and commit. macOS GitHub-hosted runners are roughly 10× the cost of Linux runners. When developers push frequently to feature branches, the macOS minutes quickly blow up the bill.
- Gate the macOS job so it only runs for PRs destined for
main(or onmainitself). Let lightweight, cross-platform steps run on push events so developers keep fast feedback while avoiding the macOS multiplier for every branch push.
main:
- Feature-branch pushes get fast, inexpensive validation.
- Full macOS integration tests run only when the change is a candidate to merge, preserving required checks without constant high-cost usage.
- Consider self-hosted macOS runners for sustained macOS workloads. Self-hosting removes per-minute GitHub charges for those runs and can drastically reduce long-term costs when usage is steady.
Self-hosting macOS runners reduces GitHub billing but introduces operational overhead: hardware provisioning, OS updates, security hardening, and compliance with Apple’s licensing terms. Evaluate total cost of ownership before migrating.
Scenario 2 — Windows runners: trim 2× multiplier waste
Problem: running Windows-based steps on every branch and commit. Windows GitHub-hosted runners cost roughly 2× a Linux runner. If many steps don’t truly require Windows, this becomes an avoidable expense.
- Audit and consolidate cross-platform steps to Linux. If tests and tools run on Node.js, Python, or inside Docker containers, run them on
ubuntu-latestto use the baseline cost.

- Restrict Windows-only jobs to when they’re necessary — for example, when the PR targets
mainor when changes are merged intomain.
main:

Quick reference: cost impact and tactics
Best practices:
- Run quick, fast-feedback tests on Linux for every push.
- Run expensive platform-specific integration tests only when a change is a candidate for merge (PRs targeting
mainor onmainitself). - Where usage is consistent and predictable, evaluate self-hosted runners for macOS/Windows and compare TCO including maintenance and licensing.
- Use job-level
ifconditions and theon:triggers to finely control when jobs run.