Skip to content

fix(budget): request the billing permission and say so when it is missing - #130

Merged
ExtraToast merged 1 commit into
mainfrom
fix/budget-billing-permission
Aug 29, 2026
Merged

fix(budget): request the billing permission and say so when it is missing#130
ExtraToast merged 1 commit into
mainfrom
fix/budget-billing-permission

Conversation

@ExtraToast

Copy link
Copy Markdown
Contributor

What the first real run showed

##[notice]10 private repo(s) of 33 in JorisJonkers-dev          <- App token fine here
##[warning]gh api .../settings/billing/usage failed: 403 Resource not accessible by integration
##[error]could not read billing usage

Billing sits behind its own App permission — "Organization plan", read-only — which the token was never requesting. My local PAT could read the endpoint, which is why this passed local verification and failed in CI.

Fix, and what it does not fix

permission-organization-plan: read is now requested. That is necessary but not sufficient: the App must also have been granted that permission, and the updated installation permissions accepted. That is an owner action — see the note in JorisJonkers-dev/.github#126.

Alternative if you would rather not touch the App: supply BUDGET_TOKEN, a token with org billing read access. The workflow already prefers it over the App token.

Better failure message

The old text — "the endpoint or token scope may have changed" — sent you nowhere. It now names the cause, the remedy, and the diagnostic that gives it away: repo listing succeeding while billing 403s is precisely this and nothing else. It also records that the classic /orgs/{org}/settings/billing/actions endpoint is gone (410), so nobody re-derives that.

Still fails loud

The watchdog exits non-zero when it cannot read the budget, rather than reporting 0%. A budget watchdog that quietly reports 0% because it lost access is worse than an absent one — it looks like good news.

…sing

The first real run reached the billing endpoint and got 403 "Resource not
accessible by integration", while the same App token happily listed all 33
repos in the org. Billing sits behind its own App permission -- "Organization
plan", read-only -- which the token was never asking for.

Requesting it here is necessary but not sufficient: the App must also have
been granted that permission and the updated installation permissions
accepted, which is an owner action rather than something a workflow can do.

So the failure message now names the actual cause and the remedy instead of
the vague "endpoint or token scope may have changed", and points out the
diagnostic that gives it away: repo listing succeeding while billing 403s is
precisely this and nothing else. It also records that the classic billing
endpoint is gone (410), so nobody re-diagnoses that from scratch.

The watchdog still fails loud rather than reporting zero when it cannot read
the budget. A budget watchdog that quietly reports 0% because it lost access
is worse than an absent one: it looks like good news.

Refs #126
@ExtraToast
ExtraToast merged commit a7f77c0 into main Aug 29, 2026
6 checks passed
@ExtraToast
ExtraToast deleted the fix/budget-billing-permission branch August 29, 2026 21:07
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.

1 participant