Skip to content

Upgrade go-github to v92 and move billing metrics to the usage report API - #296

Merged
cpanato merged 1 commit into
mainfrom
chore/upgrade-go-github-v92
Oct 9, 2026
Merged

cpanato merged 1 commit into
mainfrom
chore/upgrade-go-github-v92

Conversation

@cpanato

@cpanato cpanato commented Oct 9, 2026

Copy link
Copy Markdown
Owner

Why

go-github v92 removed the legacy Actions billing endpoints (GetActionsBillingOrg/GetActionsBillingUser), which GitHub retired in favour of the enhanced billing platform usage reports.

Changes

  • go-github v66 → v92 (imports in model/ and internal/server/).
  • Billing metrics now come from the usage report of the current month (UTC) for the org (/organizations/{org}/settings/billing/usage) and user (/users/{user}/settings/billing/usage). Year and month are passed explicitly because the endpoint otherwise defaults to the whole year.
  • Metric names/labels are unchanged, semantics are:
    • actions_total_minutes_used_minutes: all Actions minutes used
    • actions_total_paid_minutes: minutes charged (netAmount / pricePerUnit)
    • actions_included_minutes: minutes covered by quota/discounts (total − paid). No longer the plan allowance, the new API doesn't report it
    • actions_total_minutes_used_by_host_minutes: host_type stays UBUNTU/WINDOWS/MACOS for standard runners; larger runners use the SKU (e.g. actions_linux_4-core). Host types no longer reported are dropped.
  • golang.org/x/oauth2 replaced by github.WithAuthToken and removed from go.mod.
  • Deprecated github.String/Bool/Int64 helpers replaced with new(...) using go fix (required by lint).
  • README documents the new behaviour and token requirement.
  • New tests for the aggregation and the org/user collectors against a fake GitHub API.

Notes / risks

  • The org endpoint is only available to orgs on the enhanced billing platform and requires an org admin token; the old scopes (repo/admin:org/user) guidance was removed from the README since I couldn't confirm the new equivalents. Worth testing with a real token.
  • The report returns per-day/per-repo items, so the payload can be large for big orgs; with the default 5s BILLING_POLL_SECONDS consider raising the interval. A follow-up could switch to the (public preview) usage summary endpoint, which returns aggregated quantities.

Validation

go build, go test -race, golangci-lint (0 issues).

… API

The legacy Actions billing endpoints were retired by GitHub and removed
from go-github, so the billing metrics are now built from the current
month's billing usage report (org and user).

- actions_total_minutes_used_minutes: all Actions minutes used
- actions_total_paid_minutes: minutes charged (net amount / price per unit)
- actions_included_minutes: minutes covered by quota/discounts (total - paid)
- actions_total_minutes_used_by_host_minutes: host_type keeps UBUNTU,
  WINDOWS and MACOS for standard runners, the SKU for larger runners
- Replace oauth2 with github.WithAuthToken and drop golang.org/x/oauth2
- Replace deprecated github.String/Ptr helpers with new(...) via go fix

Co-authored-by: Copilot <[email protected]>
Signed-off-by: Carlos Panato <[email protected]>
@cpanato
cpanato requested a balanced review from Copilot October 9, 2026 15:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@cpanato
cpanato merged commit 14ea75c into main Oct 9, 2026
3 checks passed
@cpanato
cpanato deleted the chore/upgrade-go-github-v92 branch October 9, 2026 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants