Skip to content

fix: authenticate CLI download with the token input to avoid rate limits#61

Merged
ben-miru merged 1 commit into
mainfrom
fix/use-token-input-for-download
May 15, 2026
Merged

fix: authenticate CLI download with the token input to avoid rate limits#61
ben-miru merged 1 commit into
mainfrom
fix/use-token-input-for-download

Conversation

@miru-agents

Copy link
Copy Markdown
Collaborator

Summary

action.yml declares a token input ("GitHub token for API requests (avoids rate limits). Defaults to github.token.") but no code ever read it, and tc.downloadTool was 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): read core.getInput('token') and, when non-empty, pass Authorization: token <token> to tc.downloadTool (via the auth positional arg, dest left undefined). When no token is provided, downloadTool is called with just the URL — no empty Authorization header. The token is never logged.
  • __tests__/main.test.ts: migrated getInput mocks to a per-input helper; added tests for the authenticated path and the no-token path.
  • dist/: regenerated bundle.

Test plan

  • npm run lint clean
  • npm run ci-test — 35/35 pass; asserts downloadTool receives token <token> when a token is set and only the URL when it isn't
  • npm run packagedist/ rebuilt with the fix
  • All pre-existing tests still pass

Generated by Claude Code

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.
@miru-agents miru-agents force-pushed the fix/use-token-input-for-download branch from e91cede to 00554f8 Compare May 15, 2026 22:04
@ben-miru ben-miru merged commit 4392848 into main May 15, 2026
27 checks passed
@ben-miru ben-miru deleted the fix/use-token-input-for-download branch May 15, 2026 22: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.

3 participants