How to Measure Cost Per Pipeline Run
Pipeline cost is billable minutes times the per-minute rate for each runner type, summed across jobs.
The timing API returns billable minutes per runner OS for a run. Multiply each OS bucket by its rate (Windows and macOS bill at a multiple of Linux) and sum to get a per-run cost.
Steps
- Read billable minutes per OS from the run timing endpoint.
- Multiply each OS by its per-minute rate.
- Sum for a per-run cost and push it as a metric.
Read billable minutes
Terminal
gh api "repos/$OWNER/$REPO/actions/runs/$RUN_ID/timing" \
--jq '.billable
| to_entries
| map({os: .key, minutes: (.value.total_ms / 60000)})'Gotchas
- Standard runner minutes on private repos are billed; public-repo minutes on standard runners are free.
- Latchkey managed runners lower the per-minute rate, so the same minutes cost less per run.
Related guides
How to Set an SLO for CI Build TimeDefine an SLO for CI build time as a target percentile under a budget, then track the error budget with a Pro…
How to Track Job Duration, Queue Time, and Success RateTrack per-job duration, queue time, and success rate in CI by emitting a histogram and a counter labeled by j…