Repository navigation
Upgrade go-github to v92 and move billing metrics to the usage report API - #296
Merged
Merged
Conversation
… 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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
model/andinternal/server/)./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.actions_total_minutes_used_minutes: all Actions minutes usedactions_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 itactions_total_minutes_used_by_host_minutes:host_typestaysUBUNTU/WINDOWS/MACOSfor standard runners; larger runners use the SKU (e.g.actions_linux_4-core). Host types no longer reported are dropped.golang.org/x/oauth2replaced bygithub.WithAuthTokenand removed fromgo.mod.github.String/Bool/Int64helpers replaced withnew(...)usinggo fix(required by lint).Notes / risks
repo/admin:org/user) guidance was removed from the README since I couldn't confirm the new equivalents. Worth testing with a real token.BILLING_POLL_SECONDSconsider 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).