Skip to content

Commit ad3c560

Browse files
committed
🛂(cli) use github token to avoid 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.
1 parent 0daae71 commit ad3c560

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ Versioning](http://semver.org/spec/v2.0.0.html).
88

99
## Unreleased
1010

11-
### Changed
11+
### Added
12+
13+
- Use Gitlab token when call the Github's API
1214

1315
## [6.19.0] - 2023-09-01
1416

bin/arnold

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,14 @@ function _get_log_level_name() {
254254

255255
# Get the latest Arnold release by querying Github's API
256256
function _get_latest_release() {
257+
local auth_header=()
258+
if [ -n "$GITHUB_TOKEN" ]; then
259+
auth_header=(-H "Authorization: Bearer $GITHUB_TOKEN")
260+
fi
261+
257262
if ! curl \
258263
-s \
259-
-H "Accept: application/vnd.github.v3+json" \
264+
-H "Accept: application/vnd.github.v3+json" "${auth_header[@]}" \
260265
"https://api.github.com/repos/openfun/arnold/releases?per_page=1" ; then
261266
log debug "Cannot get latest release from GitHub.com"
262267
fi

0 commit comments

Comments
 (0)