Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃泜(cli) use github token to avoid rate limiting #782

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

claudusd
Copy link
Contributor

@claudusd claudusd commented Sep 7, 2023

Purpose

If we execute a lot of Arnold command, this will reach the Github API rate limiting.
When we reach the limit Arnold will fail because it can parse the Github response and stop with this error

jq: error (at <stdin>:1): Cannot index object with number

Proposal

Use the environment variable GITHUB_TOKEN to authenticate to the Github API and increase the API rate limiting.

Github has an API rate limiting. This rate limiting could
Be increase if we are authenticated. If the environment
variable GITHUB_TOKENiIs defined Arnold will use it to auth.
@claudusd claudusd marked this pull request as ready for review September 8, 2023 09:14
### Changed
### Added

- Use Gitlab token when call the Github's API
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- Use Gitlab token when call the Github's API
- Use GitHub token to call Github's API when the `GITHUB_TOKEN` environment variable is defined

@@ -254,9 +254,14 @@ function _get_log_level_name() {

# Get the latest Arnold release by querying Github's API
function _get_latest_release() {
local auth_header=()
Copy link
Contributor

Choose a reason for hiding this comment

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

I prefer declare which is more explicit as it can cast vars:

Suggested change
local auth_header=()
declare -a auth_header

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.

None yet

2 participants