fix: authenticate CLI download with the token input to avoid rate limits#61
Merged
Conversation
The `token` action input (defaulting to github.token) was declared in
action.yml but never read, so release-asset downloads were always
anonymous and hit GitHub's per-IP rate limits on shared CI runners.
Read core.getInput('token') and pass it as `token <TOKEN>` auth to
tool-cache downloadTool when present; fall back to an unauthenticated
download when no token is provided.
e91cede to
00554f8
Compare
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.
Summary
action.ymldeclares atokeninput ("GitHub token for API requests (avoids rate limits). Defaults to github.token.") but no code ever read it, andtc.downloadToolwas called with no auth argument. Release-asset downloads were therefore always unauthenticated — on shared CI runner IPs this hits GitHub's anonymous rate limits and causes intermittent install failures, while the advertised mitigation was a no-op.Changes
src/main.ts(downloadMiruCLI): readcore.getInput('token')and, when non-empty, passAuthorization: token <token>totc.downloadTool(via theauthpositional arg,destleftundefined). When no token is provided,downloadToolis called with just the URL — no emptyAuthorizationheader. The token is never logged.__tests__/main.test.ts: migratedgetInputmocks to a per-input helper; added tests for the authenticated path and the no-token path.dist/: regenerated bundle.Test plan
npm run lintcleannpm run ci-test— 35/35 pass; assertsdownloadToolreceivestoken <token>when a token is set and only the URL when it isn'tnpm run package—dist/rebuilt with the fixGenerated by Claude Code