mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-11 04:02:55 +03:00
pantheon.updateScript: support an OAUTH_TOKEN
Sometimes I get rate limited.
This commit is contained in:
parent
d04e10b3d7
commit
0e7b294777
@ -114,7 +114,26 @@ EOF
|
||||
function get_latest_tag ( ) {
|
||||
repo_name="$1"
|
||||
|
||||
curl --silent --show-error --fail -X GET "https://api.github.com/repos/elementary/$repo_name/releases/latest" | jq -r '.tag_name'
|
||||
OAUTH_TOKEN=$(printenv OAUTH_TOKEN)
|
||||
|
||||
if [ -n "$OAUTH_TOKEN" ]; then
|
||||
curl \
|
||||
--silent \
|
||||
--show-error \
|
||||
--fail \
|
||||
-X GET \
|
||||
--header "Authorization: token $OAUTH_TOKEN" \
|
||||
"https://api.github.com/repos/elementary/$repo_name/releases/latest" \
|
||||
| jq -r '.tag_name'
|
||||
else
|
||||
curl \
|
||||
--silent \
|
||||
--show-error \
|
||||
--fail \
|
||||
-X GET \
|
||||
"https://api.github.com/repos/elementary/$repo_name/releases/latest" \
|
||||
| jq -r '.tag_name'
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user