Skip to content
Latchkey

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

Run this faster and cheaper on Latchkey managed runners. Start free →