Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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


## [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=()
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

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