Skip to content

Commit

Permalink
Update lint.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamedNasser8 committed Jun 4, 2024
1 parent fdb40f4 commit df95dfd
Showing 1 changed file with 24 additions and 16 deletions.
40 changes: 24 additions & 16 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -1,29 +1,37 @@
name: Lint Code
name: Lint and Auto-Fix Code

on: [push, pull_request]

jobs:
lint:
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 flake8
- name: Lint with flake8
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 .
black:
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 black
run: pip install black
- name: Run black
run: black . --check

- name: Commit and push changes if needed
run: |
git config --global user.name 'github-actions'
git config --global user.email '[email protected]'
git add -A
git diff-index --quiet HEAD || git commit -m 'Apply lint auto-fixes'
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit df95dfd

Please sign in to comment.