From 0e7b2947771cf25f69545f3caa016ba58a2a6221 Mon Sep 17 00:00:00 2001 From: worldofpeace Date: Mon, 25 Nov 2019 15:56:49 -0500 Subject: [PATCH] pantheon.updateScript: support an OAUTH_TOKEN Sometimes I get rate limited. --- pkgs/desktops/pantheon/update.sh | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/pkgs/desktops/pantheon/update.sh b/pkgs/desktops/pantheon/update.sh index 8d002fe47c27..4897697d94fe 100755 --- a/pkgs/desktops/pantheon/update.sh +++ b/pkgs/desktops/pantheon/update.sh @@ -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 } #