Skip to content

Instantly share code, notes, and snippets.

@ferPrieto
Created May 18, 2023 07:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ferPrieto/bbc86185ac5d77f1ba2d067a125bd551 to your computer and use it in GitHub Desktop.
Save ferPrieto/bbc86185ac5d77f1ba2d067a125bd551 to your computer and use it in GitHub Desktop.
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