Skip to content

Update views.py

Update views.py #3

name: Check Python Code Formatting
on:
pull_request:
branches:
- main
jobs:
format-check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12.x"
- name: Install Black
run: pip install black
- name: Run Black
run: black .
- name: Commit changes if formatting is needed
run: |
git config --local user.name "github-actions[bot]"
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git add .
git diff --cached --exit-code || git commit -m "Auto-format code with Black"
- name: Push changes back to the pull request branch
uses: gr2m/create-or-update-pull-request-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}