Update lint.yaml #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Lint and Auto-Fix Code | |
on: [push, pull_request] | |
jobs: | |
lint_and_fix: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
pip install black isort flake8 | |
- name: Run black (auto-fix) | |
run: black . | |
- name: Run isort (auto-fix) | |
run: isort . | |
- name: Run flake8 (lint only) | |
run: flake8 . | |
- name: Commit and push changes if needed | |
run: | | |
git config --global user.name 'github-actions' | |
git config --global user.email 'github-actions@github.com' | |
git add -A | |
git diff-index --quiet HEAD || git commit -m 'Apply lint auto-fixes' | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |