diff --git a/.github/workflows/backend-ci.yml b/.github/workflows/backend-ci.yml index cd1a378..7f1bba1 100644 --- a/.github/workflows/backend-ci.yml +++ b/.github/workflows/backend-ci.yml @@ -47,11 +47,15 @@ jobs: - name: Run pylint on backend run: | - pylint --exit-zero --output-format=json $(git ls-files '*.py') > pylint_report.json - pylint_score=$(jq '[.[] | select(.score != null) | .score] | add / length' pylint_report.json) - echo "Pylint score: $pylint_score" - if (( $(echo "$pylint_score < 8.0" | bc -l) )); then - echo "Pylint score too low ($pylint_score)!" && exit 1 + changed_files=$(git diff --name-only origin/main...HEAD | grep '\.py$' || true) + if [ -n "$changed_files" ]; then + pylint $changed_files --exit-zero | tee pylint.log + SCORE=$(tail -n 2 pylint.log | grep -oP '[0-9]+\.[0-9]+(?=/10)') + echo "Pylint score: $SCORE" + python -c "import sys; sys.exit(0 if float('$SCORE') >= 8.0 else 1)" + else + echo "No Python files changed, skipping pylint." + exit 0 fi - name: Start backend server (background)