-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (40 loc) · 1.24 KB
/
code-analysis.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
name: Code Analysis
on:
pull_request:
branches: [ main ]
jobs:
code_analysis:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Setup Poetry
uses: Gr1N/setup-poetry@v9
- name: Install Packages
run: poetry install
- name: Flake8 (Linter)
run: poetry run flake8
- name: isort (Import Sorter)
run: poetry run isort
- name: Black (Code Formatter)
run: find . -type f -name "*.py" | xargs poetry run black
- name: Check for Changes
run: |
if [[ $(git diff --stat) != '' ]]; then
echo "changes_detected=true" >> $GITHUB_ENV
else
echo "changes_detected=false" >> $GITHUB_ENV
fi
- name: Commit and Push Changes
if: env.changes_detected == 'true'
run: |
git config user.name code-analysis-action
git config user.email [email protected]
git commit -a -m "Changes by Code Analysis Action" --no-verify
git push