Skip to content

Commit

Permalink
🛂(cli) use github token to avoid rate limiting
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
claudusd committed Sep 7, 2023
1 parent 0daae71 commit e15f1b0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ Versioning](http://semver.org/spec/v2.0.0.html).

## Unreleased

### Changed
### Added

- Use Gitlab token when call the Github's API

## [6.19.0] - 2023-09-01

Expand Down
7 changes: 6 additions & 1 deletion bin/arnold
Original file line number Diff line number Diff line change
Expand Up @@ -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=""
if [ -n "$GITHUB_TOKEN" ]; then
auth_header="-H 'Authorization: Bearer $GITHUB_TOKEN'"
fi

if ! curl \
-s \
-H "Accept: application/vnd.github.v3+json" \
-H "Accept: application/vnd.github.v3+json" $auth_header \
"https://api.github.com/repos/openfun/arnold/releases?per_page=1" ; then
log debug "Cannot get latest release from GitHub.com"
fi
Expand Down

0 comments on commit e15f1b0

Please sign in to comment.