Chaffbroom

Chaffbroom Tollbook

Free & source available

GitHub gives no per-PR billing data, so Chaffbroom Tollbook rebuilds the cost from the Actions API. It posts a sticky PR comment, writes a weekly repo summary (top 5 most expensive workflows, rerun waste in dollars) and can fail a PR that goes over a budget. It is a library, a CLI and a GitHub Action.

Works withGitHub ActionsGitHub ActionsGitHubGitHub

What it does

Actions runs of PR #312test, attempt 1Linux · 10 min · $0.06test, attempt 2Linux · 10 min · $0.06ios, cancelledmacOS · 5 min · $0.31ios, next pushmacOS · 10 min · $0.62 Sticky comment This PR, list price$1.05Waste $0.37UsefulRerunsCancelled Budget $5.00 · within
Chaffbroom Tollbook prices every job of the pull request, counts reruns and cancelled runs as waste, and puts the total on the PR.

What it catches

  • Cost per PR from every job of every attempt, billed at ceil(minutes) times the rate for the runner label.
  • Rerun waste: executions that a later attempt of the same run redid.
  • Cancelled waste, for example runs cancelled by concurrency cancel-in-progress.
  • Failed jobs are counted as useful signal, not waste.
  • Cache entries and their size for the PR. The API exposes no cache hits or misses, and the comment says so.
  • Weekly per-repo summary: the most expensive workflows and the rerun waste, as a job summary and optionally an issue.
  • An optional budget gate that fails the PR check when the cost goes over.
  • With net: true, an estimated net cost next to the list price, from your billing usage report.

Install

GitHub Actions: cost job in the PR workflowyaml
on:
  pull_request:

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

jobs:
  cost:
    needs: [test]
    if: always()
    runs-on: ubuntu-slim
    permissions:
      actions: read
      pull-requests: write
    steps:
      - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
      - uses: chaffbroom/tollbook@v0
        with:
          mode: pr
          budget: "5.00"            # omit to report without gating
GitHub Actions: weekly summaryyaml
on:
  schedule:
    - cron: "0 7 * * 1"
  workflow_dispatch:

permissions:
  actions: read
  contents: read
  issues: write

jobs:
  summary:
    runs-on: ubuntu-slim
    steps:
      - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
      - uses: chaffbroom/tollbook@v0
        with:
          mode: weekly
          days: "7"
          top: "5"
          issue: "true"
Installsh
npx chaffbroom init        # shows the files it would write, writes nothing
npx chaffbroom init --yes  # writes the config and the workflows
CLIsh
npx chaffbroom tollbook pr --pr 123             # text summary
npx chaffbroom tollbook pr --pr 123 --comment   # create or update the sticky comment
npx chaffbroom tollbook pr --pr 123 --budget 5  # exit 1 if over $5
npx chaffbroom tollbook weekly --top 5 --issue  # weekly summary, also as an issue
npx chaffbroom tollbook billing --org my-org    # GitHub's per-repo Actions spend this month
npx chaffbroom tollbook prices                  # the price table, with its source and date

Step by step, with what to check after each part: installation manual. Everything else: the README.

Permissions

  • PR comment and budget gate: the cost job needs actions: read and pull-requests: write.
  • Weekly summary: actions: read and contents: read; posting the optional issue needs issues: write.
  • Net estimate (net: true): an org owner or billing manager token. GITHUB_TOKEN cannot read billing.
  • The billing command (per-repo spend) needs an org admin or billing token.
  • Without billing access the comment says Net cost unavailable and carries on with list price.
  • On fork PRs the token is read-only: posting the comment becomes a warning, and the budget gate still decides the exit code.

Privacy

  • The PR comment, budget gate and per-repo weekly summary run on your runner with your token and send nothing anywhere.
  • Workflow names, job names and runner labels are escaped in the comment, job summary and weekly issue: no HTML, no Markdown, no @mentions, no forged marker.
  • An existing comment is edited only if it starts with the hidden marker and was written by the identity the tool posts as.
  • Nothing in Chaffbroom Tollbook calls a server of ours. A planned hosted org-wide report (Enterprise, not built yet) would receive only counts and costs per repo and workflow, never logs.

Limits

  • All figures and the budget gate use list price (gross). Included minutes and discounts are not deducted because GitHub does not expose them per job or PR.
  • Self-hosted runners count as $0. Standard runners on public repos count as $0.
  • Larger-runner labels are yours: map them in runner_map in .tollbook.yml. Unmapped labels count $0 and show a warning.
  • macOS larger-runner labels are unverified against the price reference; a job priced through one gets a warning.
  • The gate counts only jobs finished when the cost job runs. A later rerun or another workflow can push the PR over budget after the check passed.
  • Rerun dedupe is unverified against a real payload: how GitHub lists carried-over jobs on a re-run of failed jobs is not documented.
  • The billing usage report only goes down to repository level, so it cannot split cost by PR or workflow.

Install Chaffbroom Tollbook

What GitHub Actions costs per pull request, reruns and cancelled runs included, as a sticky comment.