Skip to content

Commit f29ba53

Browse files
committed
add gh token to gh api calls
1 parent ac4f76c commit f29ba53

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

codacy-cli.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ fi
6565

6666
# if no version is specified, we fetch the latest
6767
if [ -z "$CODACY_CLI_V2_VERSION" ]; then
68-
CODACY_CLI_V2_VERSION="$(curl -Lq "https://api.github.com/repos/codacy/codacy-cli-v2/releases/latest" 2>/dev/null | grep -m 1 tag_name | cut -d'"' -f4)"
68+
if [ -n "$GH_TOKEN" ]; then
69+
CODACY_CLI_V2_VERSION="$(curl -Lq --header "Authorization: Bearer $GH_TOKEN" "https://api.github.com/repos/codacy/codacy-cli-v2/releases/latest" 2>/dev/null | grep -m 1 tag_name | cut -d'"' -f4)"
70+
else
71+
CODACY_CLI_V2_VERSION="$(curl -Lq "https://api.github.com/repos/codacy/codacy-cli-v2/releases/latest" 2>/dev/null | grep -m 1 tag_name | cut -d'"' -f4)"
72+
fi
6973
fi
7074

7175
# Folder containing the binary

0 commit comments

Comments
 (0)