Skip to content

Commit

Permalink
refactor<>: add the formatting to work only on the pushed files and n…
Browse files Browse the repository at this point in the history
…ot the whole repository
  • Loading branch information
Ahelsamahy committed Oct 26, 2023
1 parent 20881bf commit d2497f0
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/python-CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, 3.10]
python-version: [3.8, 3.9]

steps:
- uses: actions/checkout@v2
Expand All @@ -23,6 +23,12 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install black
- name: Check code formatting with Black
- name: Check code formatting with Black on changed files
run: |
black --check .
FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep '\.py$' | xargs)
if [ ! -z "$FILES" ]; then
# Check the formatting of those files with black
black --check $FILES
else
echo "No Python files have changed."
fi

0 comments on commit d2497f0

Please sign in to comment.