diff --git a/.github/workflows/java-11.yml b/.github/workflows/java-11.yml index 3b19a6c..311f5a7 100644 --- a/.github/workflows/java-11.yml +++ b/.github/workflows/java-11.yml @@ -26,14 +26,15 @@ on: # build execution pull_request: types: [ labeled, opened, synchronize, reopened ] - + jobs: build: - runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - name: Checkout Repository + uses: actions/checkout@v4 + - name: Set up JDK 11 uses: actions/setup-java@v4 with: @@ -59,8 +60,8 @@ jobs: - name: Log coverage percentages to workflow output run: | - echo "(java-11) coverage = ${{ steps.jacoco.outputs.coverage }}" - echo "(java-11) branches = ${{ steps.jacoco.outputs.branches }}" + echo "(java-11) coverage = ${{ steps.jacoco.outputs.coverage }}%" + echo "(java-11) branches = ${{ steps.jacoco.outputs.branches }}%" - name: Upload JaCoCo coverage report uses: actions/upload-artifact@v4 @@ -81,11 +82,17 @@ jobs: if: ${{ github.event_name == 'pull_request' }} run: | REPORT=$(<.github/badges/coverage-summary_java-11.json) + if [[ -z "$REPORT" ]]; then + echo "Coverage report not found!" >&2 + exit 1 + fi + COVERAGE=$(jq -r '.coverage' <<< "$REPORT")% BRANCHES=$(jq -r '.branches' <<< "$REPORT")% NEWLINE=$'\n' - BODY="## JaCoCo Test Coverage Summary Statistics (java-11) ${NEWLINE}* __Coverage:__ ${COVERAGE}${NEWLINE}* __Branches:__ ${BRANCHES}" - gh pr comment ${{github.event.pull_request.number}} -b "${BODY}" + BODY="## JaCoCo Test Coverage Summary Statistics (Java 11) ${NEWLINE}* __Coverage:__ ${COVERAGE}${NEWLINE}* __Branches:__ ${BRANCHES}" + + gh pr comment ${{ github.event.pull_request.number }} -b "${BODY}" continue-on-error: true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}