Skip to content

Merge pull request #15 from centille/dependabot/npm_and_yarn/frontend… #2

Merge pull request #15 from centille/dependabot/npm_and_yarn/frontend…

Merge pull request #15 from centille/dependabot/npm_and_yarn/frontend… #2

Workflow file for this run

name: Lint and Auto-fix Code with Black and Isort
on:
push:
branches:
- main # Run on pushes to the main branch (you can specify other branches as needed)
pull_request:
branches:
- main # Optionally run on pull requests targeting the main branch
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10' # Specify the Python version you're using
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black isort
- name: Run Isort (Auto-fix)
run: |
isort .
- name: Run Black (Auto-fix)
run: |
black .
- name: Commit changes if any
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add .
git diff-index --quiet HEAD || git commit -m "Auto-format: black and isort" || echo "No changes to commit"
- name: Push changes back to repository
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}