Skip to content

Instantly share code, notes, and snippets.

Created May 18, 2023 07:36
What would you like to do?
This piece of code gets the percentages from both secrets and Jacoco report
# Get master branch code-coverage value (from secrets)
curl -X GET '$APP_ID/secrets/CODE_COVERAGE/value' \
-H 'accept: application/json' \
-H 'Authorization: '"${BITRISE_PERSONAL_ACCESS_TOKEN}"'' \
-H 'Content-Type: application/json' > current-code-coverage.json
MASTER_BRANCH_CODE_COVERAGE=`jq -r '.value' current-code-coverage.json`
# Parse current code-coverage value (from the Jacoco report)
chmod +x $BITRISE_SOURCE_DIR/build/reports/jacoco/index.html
CURRENT_COVERAGE=$(cat $BITRISE_SOURCE_DIR/build/reports/jacoco/index.html | grep -o 'Total[^%]*%' | sed 's/<.*>/ /; s/Total//')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment