Skip to content

Commit

Permalink
Update backend-ci.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
pdr21001 authored Apr 28, 2025
1 parent 407d7e2 commit df4e836
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/backend-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit df4e836

Please sign in to comment.