-
Notifications
You must be signed in to change notification settings - Fork 2
44 lines (42 loc) · 1.26 KB
/
py_linter.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
name: python-linters
on:
push:
branches:
- main
paths:
- "**.py"
pull_request:
branches:
- main
paths:
- "**.py"
jobs:
flake8-lint:
runs-on: ubuntu-latest
name: python linters
steps:
- name: Check out source repository
uses: actions/checkout@v3
- name: Set up Python environment
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install linter dependencies
run: |
python -m pip install pip==22.2.2
pip install -r requirements-lint.txt
- name: Check for python file changes
uses: dorny/paths-filter@v2
id: filter
with:
list-files: 'shell'
filters: |
py_scripts_filter:
- added|modified: '**/*.py'
- name: Run linter
if: ${{ steps.filter.outputs.py_scripts_filter == 'true' }}
run: |
echo "Changed python files: ${{ steps.filter.outputs.py_scripts_filter_files }}"
python -m flakeheaven lint ${{ steps.filter.outputs.py_scripts_filter_files }}
python -m black --check ${{ steps.filter.outputs.py_scripts_filter_files }}
python -m isort --check ${{ steps.filter.outputs.py_scripts_filter_files }}