-
Notifications
You must be signed in to change notification settings - Fork 20
55 lines (54 loc) · 1.92 KB
/
syntax.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
45
46
47
48
49
50
51
52
53
54
55
name: syntax
on:
pull_request_target:
branches:
- "**"
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v42
with:
files: |
**/*.py
- name: Prepare python env
if: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
python -m venv env
source env/bin/activate
pip install -U pip
pip install -r requirements.txt
pip install isort[colors] colorama black pylint
- name: Run pylint
id: pylint
if: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
delimiter='$(openssl rand -hex 8)'
echo 'report<<$(delimiter)' >> $GITHUB_OUTPUT
env/bin/pylint ${{ steps.changed-files.outputs.all_changed_files }} --py-version 3.9 --exit-zero >> $GITHUB_OUTPUT
echo '$(delimiter)' >> $GITHUB_OUTPUT
- name: Post pylint output
uses: mshick/add-pr-comment@v2
if: ${{ steps.changed-files.outputs.all_changed_files }}
with:
message: |
<details>
<summary>pylint output</summary>
```
${{ steps.pylint.outputs.report }}
```
</details>
message-id: pylint-report
- name: Run black
if: ${{ steps.changed-files.outputs.all_changed_files }}
run: env/bin/black ${{ steps.changed-files.outputs.all_changed_files }} --exclude alws/alembic --check --diff --color --target-version py39
- name: Run isort
if: ${{ steps.changed-files.outputs.all_changed_files }}
run: env/bin/isort ${{ steps.changed-files.outputs.all_changed_files }} --diff --color --check-only --py 39