Repository navigation
Add a github-minutes check for GitHub-hosted usage - #12
Merged
Merged
Conversation
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
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.
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.GET /organizations/{org}/settings/billing/usage/summary?product=actions&year=…&month=…and adds upnetAmountfor the Actions product. The route job reads it once per run.route.ymlasks the App token forpermission-organization-administration: readonly when the config containsgithub-minutes. An empty permission input is ignored bycreate-github-app-token, so existing configs keep their narrow token.{ "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-routactApp needs the organization permission Administration: Read. Until it has it, the token step fails for configs that usegithub-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.route.yml; it could not be installed in this environment.Generated by Claude Code