Skip to content

Add a github-minutes check for GitHub-hosted usage - #12

Merged
jonbeckman merged 1 commit into
masterfrom
claude/project-thread-4bs466
Oct 30, 2026
Merged

jonbeckman merged 1 commit into
masterfrom
claude/project-thread-4bs466

Conversation

@jonbeckman

Copy link
Copy Markdown
Contributor

Requested by Jonathan · project thread

Summary

GitHub-hosted runners are always online, but their minutes cost money once the plan's included minutes are used up. This adds a built-in fallback check so a pool can skip GitHub-hosted runners when that happens and wait for its self-hosted runner instead.

  • "github-minutes" passes while the organization's Actions usage this month has no net cost (it is still inside the included minutes).
  • {"github-minutes": 10} passes while the paid part is at most $10.
  • The check reads GET /organizations/{org}/settings/billing/usage/summary?product=actions&year=…&month=… and adds up netAmount for the Actions product. The route job reads it once per run.
  • If the usage cannot be read (no token, no organization, missing permission, API error), the check fails and the router moves on to the next step.
  • route.yml asks the App token for permission-organization-administration: read only when the config contains github-minutes. An empty permission input is ignored by create-github-app-token, so existing configs keep their narrow token.
  • The README documents the check and the pattern of ending a chain on the primary:
{ "runs-on": "blacksmith-4vcpu-ubuntu-2404-arm", "when": { "var": "ROUTACT_BLACKSMITH_ENABLED" } },
{ "runs-on": "ubuntu-24.04-arm", "when": "github-minutes" },
{ "runs-on": "self-hosted,Linux,ARM64" }

Before using it

The solzero-routact App needs the organization permission Administration: Read. Until it has it, the token step fails for configs that use github-minutes.

Testing

  • npm run all: lint, dist/ rebuild, and 102 Jest tests pass. New tests cover config validation, the check's pass and fail cases, a failed read, and the billing request.
  • I did not run actionlint on route.yml; it could not be installed in this environment.
  • Not tested against the live billing API. The endpoint is in public preview, and the response shape comes from GitHub's docs.

Generated by Claude Code

GitHub-hosted runners are always online, but their minutes cost money
once the plan's included minutes are used up. The new check reads the
organization's billing usage summary for the month and passes while the
net Actions amount is 0, or at most a given dollar amount. A chain that
gates its GitHub-hosted step on it and ends on the primary waits for a
self-hosted runner instead of running on paid minutes.

The route workflow asks for Administration: read only when the config
uses the check. The usage is read once per run, and a failed read fails
the check so the router moves on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vdh4Z431pzGdWVWoAFNQqc
@jonbeckman jonbeckman self-assigned this Oct 30, 2026
@jonbeckman
jonbeckman merged commit 44da474 into master Oct 30, 2026
7 checks passed
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