diff --git a/.github/workflows/sonar_python.yaml b/.github/workflows/sonar_python.yaml index c8d7254..ffcef94 100644 --- a/.github/workflows/sonar_python.yaml +++ b/.github/workflows/sonar_python.yaml @@ -12,11 +12,26 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 + + - name: Check for Python files + id: check_py + run: | + if git ls-files "*.py" | grep -q "."; then + echo "Python files found" + echo "found=true" >> "$GITHUB_OUTPUT" + else + echo "No Python files found" + echo "found=false" >> "$GITHUB_OUTPUT" + fi + - name: Download coverage report + if: steps.check_py.outputs.found == 'true' uses: actions/download-artifact@v4 with: name: coverage-report + - name: SonarQube Scan + if: steps.check_py.outputs.found == 'true' uses: SonarSource/sonarqube-scan-action@v5 env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}