Repository navigation
Update lint-fix workflow to remove Python path filters #1
This file contains hidden or 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: Python Lint and Auto-Format | |
| on: | |
| push: | |
| branches: ["main", "master"] | |
| pull_request: | |
| branches: ["main", "master"] | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| lint-and-format: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install flake8 black | |
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
| - name: Run Linter (Flake8) | |
| id: lint | |
| # We use continue-on-error so the workflow proceeds to formatting if linting fails | |
| run: flake8 . --count --max-line-length=88 --statistics | |
| continue-on-error: true | |
| - name: Run Auto-formatter (Black) | |
| if: steps.lint.outcome == 'failure' | |
| run: black . | |
| - name: Create Pull Request | |
| if: steps.lint.outcome == 'failure' | |
| uses: peter-evans/create-pull-request@v6 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| commit-message: "style: auto-format python code" | |
| title: "style: Auto-format Python code" | |
| body: | | |
| The linter found errors in the code. | |
| This PR applies auto-formatting using Black to resolve formatting issues. | |
| branch: "auto-format-fixes" | |
| delete-branch: true | |
| base: ${{ github.head_ref || github.ref_name }} |