diff --git a/.github/workflows/test-vulnerabilities-data.yml b/.github/workflows/test-vulnerabilities-data.yml index d071bd1568c9..f0ad5395cf23 100644 --- a/.github/workflows/test-vulnerabilities-data.yml +++ b/.github/workflows/test-vulnerabilities-data.yml @@ -65,16 +65,20 @@ jobs: - name: Check for new vulnerabilities in Scout and Trivy files if: always() run: | - # Check if Scout vulnerabilities file is not empty - if [ -s "scout_new_vulnerabilities.csv" ]; then + # Check if Scout vulnerabilities file has data after the header + if [ $(tail -n +2 scout_new_vulnerabilities.csv | wc -l) -gt 0 ]; then echo "Scout vulnerabilities detected." cat scout_new_vulnerabilities.csv exit 1 # Fail the job if data exists + else + echo "No new Scout vulnerabilities detected." fi - - # Check if Trivy vulnerabilities file is not empty - if [ -s "trivy_new_vulnerabilities.csv" ]; then + + # Check if Trivy vulnerabilities file has data after the header + if [ $(tail -n +2 trivy_new_vulnerabilities.csv | wc -l) -gt 0 ]; then echo "Trivy vulnerabilities detected." cat trivy_new_vulnerabilities.csv exit 1 # Fail the job if data exists + else + echo "No new Trivy vulnerabilities detected." fi \ No newline at end of file