Skip to content

Python Flake8 linter workflow to replace stickler-ci #8

Python Flake8 linter workflow to replace stickler-ci

Python Flake8 linter workflow to replace stickler-ci #8

Workflow file for this run

name: Python Flake8 Linter
on:
pull_request:
jobs:
flake8-linter:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Install Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install Flake8 linter
run: pip install flake8
- name: Setup Flake8 output matcher for PR annotations
run: echo '::add-matcher::.github/workflows/flake8-linter-matcher.json'
- name: Get names of changed Python files
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: echo CHANGED_FILES=$(
gh pr view ${{ env.PR_NUMBER }}
--repo pvlib/pvlib-python
--json files
-q '.files[].path | select(endswith(".py"))'
) >> ${{ github.env }}
- name: Run Flake8 linter
if: ${{ env.CHANGED_FILES != ''}}
run: flake8
${{ env.CHANGED_FILES }}
--exclude pvlib/version.py
--ignore E201,E241,E226,W503,W504
--max-line-length 79