diff --git a/.github/workflows/shared-build-and-test.yaml b/.github/workflows/shared-build-and-test.yaml index ffcac0c..d312c6d 100644 --- a/.github/workflows/shared-build-and-test.yaml +++ b/.github/workflows/shared-build-and-test.yaml @@ -40,12 +40,15 @@ jobs: if: ${{ inputs.vulnerability_scan_only == 'false' }} working-directory: ${{ inputs.working_dir }} run: | - tests_run=$(mvn -B clean compile test | tee build.log | grep "Tests run" | awk '{print $3}') - echo "DEBUG: tests_run = $tests_run" # Print the value of tests_run + mvn -B clean compile test | tee build.log - if [ -z "$tests_run" ]; then # Check if tests_run is empty + tests_run=$(cat build.log | grep "Tests run" | awk '{print $3}') + + echo "DEBUG: tests_run = $tests_run" + + if [ -z "$tests_run" ]; then echo "WARNING: Could not determine the number of tests run." - tests_run=0 # Set a default value + tests_run=0 fi if [ "$tests_run" -eq 0 ]; then