Proper fix for coverage deployment problems.
@@ -9,8 +9,14 @@ if ! [ -f "$COVERAGE_FILE" ] ; then
fi
# From https://github.com/codacy/codacy-coverage-reporter#travis-ci
-# The option --insecure might help against GitHub-API-issues, causing responses containing "null".
-CODACY_COVERAGE_REPORTER_URL="$(curl -k https://api.github.com/repos/codacy/codacy-coverage-reporter/releases/latest | jq -r .assets[0].browser_download_url)"
+CODACY_COVERAGE_REPORTER_RELEASE="$(curl -H "Authorization: token ${GH_TOKEN}" https://api.github.com/repos/codacy/codacy-coverage-reporter/releases/latest)"
+CODACY_COVERAGE_REPORTER_URL="$(echo $CODACY_COVERAGE_REPORTER_RELEASE | jq -r .assets[0].browser_download_url)"
+if [ "$CODACY_COVERAGE_REPORTER_URL" = "null" ]; then
+ echo "Failed to get information about coday coverage reporter from GitHub:"
+ echo "$CODACY_COVERAGE_REPORTER_RELEASE"
+ exit 1
+fi
+
echo "Downloading Codacy Coverage Reporter from $CODACY_COVERAGE_REPORTER_URL"
wget -O codacy-coverage-reporter-assembly-latest.jar "$CODACY_COVERAGE_REPORTER_URL"
