forked from awsdocs/aws-doc-sdk-examples
-
Notifications
You must be signed in to change notification settings - Fork 1
36 lines (29 loc) · 905 Bytes
/
lint-python.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
name: Lint Python
on: # yamllint disable-line rule:truthy
pull_request:
workflow_dispatch:
jobs:
black:
name: Flake8 Linting & Black Formatting
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v41
with:
files: "**.py"
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
pip install black pylint
- name: Run Black & Pylint
if: steps.changed-files.outputs.any_changed == 'true'
run: |
changed_files=(${{steps.changed-files.outputs.all_changed_files}})
black "${changed_files[@]}"
pylint --rcfile .github/linters/.python-lint "${changed_files[@]}"