Skip to content
Sengi

Audit your GitHub Actions bill with one gh command

How do you find out what is driving your GitHub Actions bill?

Run the read-only script on this page against a repository: ./actions-audit.sh your-org/your-repo 30. It uses the GitHub CLI to read every workflow run and job from the last 30 days, then prints the billed minutes after GitHub’s per-job round-up, how many minutes that rounding adds, how many jobs finish in under a minute, the minutes spent on re-runs and cancelled jobs, the five workflows that bill the most, and what the Linux jobs would cost on Sengi at the published prices. On a week of HashiCorp Terraform’s public CI it found 245 of 707 jobs finished in under a minute and rounding added 17% to the billed minutes.

Last checked November 28, 2026: run that day against public repositories and a private test repository; GitHub rates and rules from its Actions runner pricing reference, Actions billing documentation and REST reference, read the same day.

Why the bill’s totals do not tell you what to fix

A monthly total tells you how much, not why. Three things inflate it that you only see per job:

  • Rounding. GitHub’s pricing reference: “GitHub rounds the minutes and partial minutes each job uses up to the nearest whole minute.” A 10-second job bills a full minute. A workflow split into eight small jobs bills at least eight minutes, even if the work takes one.
  • Re-runs. GitHub’s billing documentation counts every attempt: its example is a 10-minute workflow that fails after 5 minutes and is re-run, for 15 billed minutes in total. Flaky tests show up as re-run minutes.
  • Cancelled and superseded runs. A push that lands while the previous run is still going pays for both unless the workflow cancels the old one.

The REST API has the start and finish time of every job, with its runner label and attempt number, so all three can be counted.

The script

It needs the GitHub CLI (gh), signed in, and jq. Save it as actions-audit.sh, or download the same file from sengi.run/tools/actions-audit.sh, then run it:

chmod +x actions-audit.sh
./actions-audit.sh your-org/your-repo 30
#!/usr/bin/env bash
# actions-audit.sh: a read-only audit of one repository's GitHub Actions minutes.
# Usage: ./actions-audit.sh owner/repo [days]   (needs gh, signed in, and jq)
# It only reads (GET) workflow runs and jobs. Nothing is changed or sent anywhere.
set -euo pipefail
repo=${1:?usage: actions-audit.sh owner/repo [days]}
days=${2:-30}
max_runs=${MAX_RUNS:-1000}   # one API call per run; GitHub allows 5,000 an hour
private=$(gh api "repos/$repo" -q .private)
since=$(date -u -d "-$days days" +%F 2>/dev/null || date -u -v-"$days"d +%F)

gh api --paginate "repos/$repo/actions/runs?per_page=100&created=%3E%3D$since" \
  -q '.workflow_runs[].id' |
awk -v m="$max_runs" 'NR <= m { print }
  END { if (NR >= 1000) print "warning: GitHub lists at most 1,000 runs for a date filter; use fewer days" > "/dev/stderr"
        else if (NR > m) print "warning: stopped at MAX_RUNS=" m " of " NR " runs" > "/dev/stderr" }' |
while read -r run; do
  # A run that cannot be read (deleted, or a rate limit) is counted as skipped, not silently lost.
  gh api --paginate "repos/$repo/actions/runs/$run/jobs?filter=all&per_page=100" \
    -q '.jobs[] | select(.runner_name != null and .runner_name != "" and .completed_at != null)
        | {run: .run_id, name, start: .started_at, end: .completed_at,
           wf: .workflow_name, attempt: .run_attempt, result: .conclusion,
           label: (.labels | join(",")),
           secs: ((.completed_at | fromdateiso8601) - (.started_at | fromdateiso8601))}' \
    || echo '{"skipped": true}'
done | jq -rs --arg repo "$repo" --arg days "$days" --arg private "$private" '
  # GitHub list prices per minute (GitHub Actions runner pricing reference).
  def gh_rate: if test("^ubuntu-slim$") then 0.002
    elif test("^ubuntu-[0-9.]+-arm$") then 0.005
    elif test("^ubuntu-(latest|[0-9.]+)$") then 0.006
    elif test("^windows-(latest|[0-9]+)$") then 0.010
    elif test("^macos-(latest|[0-9]+)$") then 0.062
    else null end;   # self-hosted and larger runners: not priced
  def linux_x64: test("^ubuntu-(latest|[0-9.]+|slim)$");
  (map(select(.skipped)) | length) as $skipped | map(select(.skipped | not))
  # Re-running failed jobs lists the jobs that had passed again under the new attempt, with
  # their original start and finish times (seen November 2026): count each of those once.
  | group_by([.run, .name, .start, .end]) | map(min_by(.attempt))
  | map(select(.secs > 0) | . + {billed: ((.secs / 60) | ceil), rate: (.label | gh_rate)}) as $jobs
  | ($jobs | map(select(.rate != null))) as $priced
  | def sum(f): map(f) | add // 0;
    def usd: (. * 100 | round / 100 | tostring) as $s
      | "$" + ($s | if test("\\.") then (split(".") | .[0] + "." + (.[1] + "0")[0:2]) else . + ".00" end);
    def pct(a; b): if b == 0 then "0%" else ((a / b * 1000 | round) / 10 | tostring) + "%" end;
  ($priced | sum(.billed)) as $billed
  | ($priced | sum(.secs / 60)) as $used
  | ($priced | map(select(.attempt > 1)) | sum(.billed)) as $rerun
  | ($priced | map(select(.result == "cancelled")) | sum(.billed)) as $cancel
  | ($priced | map(select(.secs < 60)) | length) as $short
  | ($priced | map(select(.label | linux_x64))) as $lx
  | "Repository \($repo), last \($days) days: \($jobs | length) jobs that ran",
    "Billed minutes (GitHub rounds each job up): \($billed)",
    "Minutes actually used:                     \($used * 10 | round / 10)",
    "Lost to per-job rounding:                  \(($billed - $used) * 10 | round / 10) (\(pct($billed - $used; $billed)))",
    "Jobs under one minute:                     \($short) of \($priced | length)",
    "Minutes on re-run attempts:                \($rerun) (\(pct($rerun; $billed)))",
    "Minutes on cancelled jobs:                 \($cancel) (\(pct($cancel; $billed)))",
    "At GitHub list prices:                     \($priced | sum(.billed * .rate) | usd)",
    (if $private == "false" then "  (public repository: standard runners are free here and ubuntu-latest has 4 vCPU; figures are at private-repository rates)" else empty end),
    "",
    "Top workflows by billed minutes:",
    ($priced | group_by(.wf) | map({wf: .[0].wf, m: sum(.billed), n: length})
      | sort_by(-.m) | .[:5][] | "  \(.m) min  \(.n) jobs  \(.wf)"),
    "",
    ($priced | map(select(.label | test("^(windows|macos)-"))) as $wm
      | if ($wm | length) > 0 then "Windows and macOS jobs: \($wm | sum(.billed)) min, \($wm | sum(.billed * .rate) | usd) (these stay on GitHub)" else empty end),
    "Linux x64 jobs (\($lx | sum(.billed)) min, \($lx | sum(.billed * .rate) | usd) at GitHub prices) on Sengi, also rounded up per job:",
    "  Basic 2 vCPU at $0.001/min:   \($lx | sum(.billed) * 0.001 | usd)",
    "  Premium 2 vCPU at $0.003/min: \($lx | sum(.billed) * 0.003 | usd)",
    (if ($jobs | length) > ($priced | length)
     then "Not priced (self-hosted or larger-runner labels): \($jobs | length - ($priced | length)) jobs, \($jobs | map(select(.rate == null)) | sum(.billed)) min" else empty end),
    (if $skipped > 0 then "Runs that could not be read and are not counted: \($skipped)" else empty end)'

What it does, in order:

  1. Reads the repository’s visibility, because standard runners are free in public repositories.
  2. Lists the workflow runs created in the window, one page of 100 at a time.
  3. For each run, lists its jobs with filter=all, which includes earlier attempts. Jobs that never got a runner (cancelled while queued) are dropped: they were never billed.
  4. Counts each job once. When you re-run only the failed jobs, GitHub lists the jobs that had passed again under the new attempt with their original start and finish times; the script keeps the earliest copy so they are not counted twice. We checked this on a run with one passing and one failing job.
  5. Rounds each job up to whole minutes and prices it by label at GitHub’s list rates: $0.002 for ubuntu-slim, $0.006 for ubuntu-latest and numbered ubuntu- labels, $0.005 for the arm64 labels, $0.010 for Windows and $0.062 for macOS, from GitHub’s Actions runner pricing reference read November 28, 2026. Larger-runner and self-hosted labels are counted but not priced.

It makes one API call per run. GitHub allows an authenticated user 5,000 REST calls an hour (gh api rate_limit shows yours), and the runs list returns at most 1,000 runs for a date filter, so the script stops at 1,000 and prints a warning when it hits that limit: run it for fewer days. Set MAX_RUNS lower to go faster. A run it cannot read, such as one deleted mid-audit, is reported as skipped rather than silently left out. A week of Terraform’s CI took about two minutes.

Sample output: a week of Terraform’s CI

HashiCorp’s Terraform repository is public and busy, so it makes a good test. This is the script’s output, unedited, run on November 28, 2026 for the 7 days before:

$ ./actions-audit.sh hashicorp/terraform 7
Repository hashicorp/terraform, last 7 days: 707 jobs that ran
Billed minutes (GitHub rounds each job up): 2293
Minutes actually used:                     1909.2
Lost to per-job rounding:                  383.8 (16.7%)
Jobs under one minute:                     245 of 707
Minutes on re-run attempts:                38 (1.7%)
Minutes on cancelled jobs:                 1 (0%)
At GitHub list prices:                     $15.30
  (public repository: standard runners are free here and ubuntu-latest has 4 vCPU; figures are at private-repository rates)

Top workflows by billed minutes:
  1232 min  400 jobs  build
  858 min  167 jobs  Quick Checks
  65 min  23 jobs  equivalence-test-diff
  42 min  21 jobs  equivalence-test-update
  27 min  27 jobs  Enforce Changelog

Windows and macOS jobs: 48 min, $1.83 (these stay on GitHub)
Linux x64 jobs (2245 min, $13.47 at GitHub prices) on Sengi, also rounded up per job:
  Basic 2 vCPU at $0.001/min:   $2.25
  Premium 2 vCPU at $0.003/min: $6.74

Terraform pays nothing for this, because standard runners are free in public repositories, and there ubuntu-latest has 4 vCPU, so a private repository on 2 vCPU would take longer. What the output shows:

  • A third of the jobs finished in under a minute (245 of 707), and rounding added 384 minutes, 17% of the billed total.
  • Two workflows carry the bill. build and Quick Checks are 91% of the minutes; everything else is small.
  • Re-runs were light: 38 minutes, under 2%. Cancelled jobs cost one minute.

The cheapest fix for each finding

FindingFix
Many jobs under one minuteMerge small jobs that run on every push into one job with several steps, so they share one round-up. Keep separate jobs only where you need separate required checks or parallelism.
High re-run minutesFind the flaky tests rather than re-running. Re-run only failed jobs (gh run rerun RUN_ID --failed), never the whole workflow.
High cancelled minutes, or many runs per pull requestCancel superseded runs with a concurrency group (below).
One workflow dominatesRun it only when its files change (on.push.paths), skip draft pull requests, and cache dependencies.
Windows or macOS minutesRun only what needs those systems there; macOS is $0.062 a minute, ten times Linux.

The concurrency group cancels the previous run for the same branch or pull request when a new push arrives:

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

Skipping drafts is one line on the job:

jobs:
  test:
    if: github.event.pull_request.draft != true

Run the script again a week after a change and compare the two outputs.

What the same minutes cost on Sengi

The last lines of the output price the Linux x64 jobs at Sengi’s published rates: $0.001 a minute on Sengi Basic 2 vCPU and $0.003 on Sengi Premium 2 vCPU. Sengi rounds each job up to a whole minute once, as GitHub does, so the script uses the same billed minutes; the rate is what changes. For Terraform’s week that is 2,245 Linux minutes, $13.47 at GitHub’s private-repository rates and $2.25 on Sengi Basic. Windows and macOS jobs stay on GitHub, because Sengi runs Linux x64 only.

The rounding waste and re-runs the script finds cost the same number of minutes anywhere, so fix those first; a cheaper rate then applies to what is left. Sengi Basic comes in 4 and 8 vCPU too, at $0.002 and $0.004 a minute, and new accounts get 3,000 free credits a month, enough for 3,000 Basic minutes at 2 vCPU, with no card. To price other volumes, use the GitHub Actions cost calculator; to move a job without risk, see switching runners with a repository variable.

Frequently asked questions

Does the script change anything in my repository?

No. It makes only GET requests through gh api: the repository, its workflow runs and each run's jobs. It writes nothing to GitHub and sends nothing anywhere else; the output is printed in your terminal.

What permissions does it need?

Read access to the repository's Actions data. If gh auth status shows you signed in and you can open the repository's Actions tab, it works.

Why does my bill not match the script's dollar figure?

The script prices every job at GitHub's list rate before your plan's included usage, which is $12 to $300 a month depending on the plan, and it skips larger runners and self-hosted runners, whose labels it cannot price. Your invoice is the authority; the script tells you where the minutes went.

How far back can it look?

As far as GitHub keeps the runs, but GitHub's REST reference says the runs list returns at most 1,000 results when filtered by creation date. For a busy repository, use a shorter window such as 7 days.

Does Sengi round up per job too?

Yes. Sengi meters the time GitHub reports between a job starting and finishing and rounds it up to a whole minute once per job, so rounding waste stays the same on Sengi. The rate per minute is what changes: $0.001 on Sengi Basic 2 vCPU against GitHub's $0.006.

Keep your workflow. Cut your runner rate.

Sengi Basic starts at $0.001 a minute for 2 vCPU. Choose 4 or 8 vCPU for $0.002 or $0.004 a minute. Premium stays optional at $0.003, $0.006 and $0.012.

Start without a card ↗︎

See Basic pricing · Switch with your coding agent