Skip to content
Merged
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
2 changes: 1 addition & 1 deletion package/contents/tools/sh/nixdatifier
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ cmd_notes() {
row=$(update_row) || exit $?
out=$(NOTE='Fetching release notes…' cached notes 86400 -- timeout --kill-after=5s 60s "$here/release-notes" \
"$(jq -r .url <<<"$row")" "$(jq -r .current <<<"$row")" "$(jq -r .latest <<<"$row")" "$(jq -r .modified <<<"$row")") ||
die 'could not fetch release notes (rate limit? set GITHUB_TOKEN or github_token_file)'
die 'could not fetch release notes (rate limit? GitHub allows 60 requests per hour without a login: set GITHUB_TOKEN or github_token_file, or install gh, run gh auth login and set github_use_gh on)'
if [[ $fmt == json ]]; then jq . <<<"$out"; return; fi
jq -r '
(if .compareUrl != "" then "Compare: \(.compareUrl)\n" else empty end),
Expand Down
9 changes: 8 additions & 1 deletion package/contents/tools/sh/release-notes
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,14 @@ fetch() {
200) return 0 ;;
403|429)
if grep -qi '^x-ratelimit-remaining: *0' "$tmp/$1.h"; then
echo "GitHub API rate limit reached. Try again later, or set a GitHub token (GITHUB_TOKEN or a token file)." >&2
local reset
reset=$(sed -n 's/^[Xx]-[Rr]ate[Ll]imit-[Rr]eset: *\([0-9]*\).*/\1/p' "$tmp/$1.h" | head -n1)
reset=$(date -d "@${reset:-0}" +%H:%M 2>/dev/null) || reset=""
if [ -n "$token" ]; then
echo "GitHub API rate limit reached${reset:+ (resets around $reset)}. Try again later." >&2
else
echo "GitHub API rate limit reached${reset:+ (resets around $reset)}: without a login GitHub allows only 60 requests per hour. Add a GitHub token (GITHUB_TOKEN or a token file in the settings) or install the GitHub CLI (gh), run 'gh auth login' and enable 'Use the GitHub CLI login'." >&2
fi
else
echo "GitHub refused the request (HTTP $code)" >&2
fi
Expand Down
Loading