Skip to content

Instantly share code, notes, and snippets.

@ferPrieto
Created May 18, 2023 07:36
Embed
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 'https://api.bitrise.io/v0.1/apps/$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