Skip to content

Warn before the Actions minute budget runs out #126

Description

@ExtraToast

What to build

The organization ran out of Actions minutes on 2026-08-27 with no warning at all. Every private repo went dark mid-working-session — runs allocated nothing and failed in three seconds — and the first anyone knew of it was workflows failing for reasons that looked like broken code.

Nothing watches the spend. Add a watchdog that warns while there is still room to act.

It reads the org's Actions consumption, compares it against the included allowance, and raises a visible alert as the month's usage crosses thresholds — early enough that a busy week can be noticed before it becomes an outage. Run it on a schedule from a public repo, where standard runners are free, so the watchdog itself never contributes to the problem it watches.

The billing API moved and the old endpoint is gone. /orgs/{org}/settings/billing/actions now returns 410 This endpoint has been moved. The enhanced billing endpoint at /organizations/{org}/settings/billing/usage works and — usefully — needs no admin:org scope, only an ordinary token. It accepts year and month, and returns per-repo line items carrying product, sku, unitType, quantity and netAmount. Confirmed working against this org while writing this ticket.

Two traps that will otherwise produce a watchdog that reads plausibly and reports nonsense:

  • The response covers public and private repos together, and public usage is fully discounted rather than absent. Filter on what actually consumes the allowance, or the number will read roughly five times too high.
  • The allowance is consumed in billable minutes, not wall-clock minutes. GitHub rounds every job up to a full minute, so 561 minutes of real compute billed 2,845. A watchdog reasoning about run durations will consistently under-report.

Alert somewhere a human sees without looking — the estate already has a Discord webhook path for this.

Acceptance criteria

  • Current month private-repo Actions consumption is reported against the allowance
  • Crossing a threshold produces an alert a human receives without going looking for it
  • The watchdog runs from a public repo and its own runs are billed as free
  • Public-repo usage is excluded from the figure compared against the allowance
  • The threshold alert is verified by forcing it to fire — a watchdog whose alarm has never been observed to trigger is not known to work
  • The figure it reports is reconciled once against the billing UI, so a wrong-by-a-factor reading is caught immediately rather than at the next outage

Blocked by

  • None — can start immediately.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: toolingReusable workflows, Gradle, templates, Renovate, and API tooling.component: ciContinuous integration workflow or check behavior.priority: P1High; important and should be handled in the current iteration.type: featureNew user-facing or operator-facing capability.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions