Skip to content

Conversation

nirvanin
Copy link
Contributor

@nirvanin nirvanin commented Aug 7, 2025

  • All tests have passed. If this feature is not already covered by the tests, new tests have been added.
  • The pull request is targeting the dev branch.
  • The code has been validated to compile successfully by running go vet ./....
  • The code has been formatted properly using go fmt ./....

Why

When JFrog CLI checks for the latest version, it calls the GitHub Releases API.
Without a token, these requests are anonymous and can quickly hit GitHub’s low rate limit, especially in CI.
This surfaced in the setup action as workflows intermittently failing due to HTTP 403 from the GitHub API (rate limit).


What’s changing

  1. Tokenized version check

    • utils.CheckNewCliVersionAvailable(currentVersion) now reads JFROG_CLI_GITHUB_TOKEN from the environment and uses it as a Bearer token for the GitHub API request.
    • If absent, the call proceeds anonymously, but with clearer logging.
  2. New env var

    • Introduce JFROG_CLI_GITHUB_TOKEN, documented in docs/common/env.go and surfaced in global env var help.
  3. API & flags cleanup

    • Remove the app-level --github-token global flag and its plumbing from main.go.
    • Configuration via env var is now the single supported path.

Relates to :
jfrog/setup-jfrog-cli#223

Copy link
Contributor

@EyalDelarea EyalDelarea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

See my comments which are open for discussion.

Copy link
Contributor

@EyalDelarea EyalDelarea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :)
Just see the interval change comment

@EyalDelarea EyalDelarea added the bug Something isn't working label Aug 10, 2025
@EyalDelarea EyalDelarea changed the title JGC-402 - transfer github token to env var Use GitHub token for version check if available Aug 10, 2025
@EyalDelarea EyalDelarea changed the title Use GitHub token for version check if available Use GitHub token for CLI version checks (avoid anonymous rate‑limit) Aug 10, 2025
@EyalDelarea EyalDelarea added the safe to test Approve running integration tests on a pull request label Aug 10, 2025
@github-actions github-actions bot removed the safe to test Approve running integration tests on a pull request label Aug 10, 2025
@ehl-jf ehl-jf added the safe to test Approve running integration tests on a pull request label Aug 11, 2025
@github-actions github-actions bot removed the safe to test Approve running integration tests on a pull request label Aug 11, 2025
@ehl-jf ehl-jf merged commit 5842704 into jfrog:dev Aug 11, 2025
57 of 66 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants