26
26
# build execution
27
27
pull_request :
28
28
types : [ labeled, opened, synchronize, reopened ]
29
-
29
+
30
30
jobs :
31
31
build :
32
-
33
32
runs-on : ubuntu-latest
34
33
35
34
steps :
36
- - uses : actions/checkout@v4
35
+ - name : Checkout Repository
36
+ uses : actions/checkout@v4
37
+
37
38
- name : Set up JDK 11
38
39
uses : actions/setup-java@v4
39
40
with :
59
60
60
61
- name : Log coverage percentages to workflow output
61
62
run : |
62
- echo "(java-11) coverage = ${{ steps.jacoco.outputs.coverage }}"
63
- echo "(java-11) branches = ${{ steps.jacoco.outputs.branches }}"
63
+ echo "(java-11) coverage = ${{ steps.jacoco.outputs.coverage }}% "
64
+ echo "(java-11) branches = ${{ steps.jacoco.outputs.branches }}% "
64
65
65
66
- name : Upload JaCoCo coverage report
66
67
uses : actions/upload-artifact@v4
@@ -81,11 +82,17 @@ jobs:
81
82
if : ${{ github.event_name == 'pull_request' }}
82
83
run : |
83
84
REPORT=$(<.github/badges/coverage-summary_java-11.json)
85
+ if [[ -z "$REPORT" ]]; then
86
+ echo "Coverage report not found!" >&2
87
+ exit 1
88
+ fi
89
+
84
90
COVERAGE=$(jq -r '.coverage' <<< "$REPORT")%
85
91
BRANCHES=$(jq -r '.branches' <<< "$REPORT")%
86
92
NEWLINE=$'\n'
87
- BODY="## JaCoCo Test Coverage Summary Statistics (java-11) ${NEWLINE}* __Coverage:__ ${COVERAGE}${NEWLINE}* __Branches:__ ${BRANCHES}"
88
- gh pr comment ${{github.event.pull_request.number}} -b "${BODY}"
93
+ BODY="## JaCoCo Test Coverage Summary Statistics (Java 11) ${NEWLINE}* __Coverage:__ ${COVERAGE}${NEWLINE}* __Branches:__ ${BRANCHES}"
94
+
95
+ gh pr comment ${{ github.event.pull_request.number }} -b "${BODY}"
89
96
continue-on-error : true
90
97
env :
91
98
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments