-
Notifications
You must be signed in to change notification settings - Fork 1
37 lines (35 loc) · 1.11 KB
/
code_quality.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
name: Code Quality Checks
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
code-quality-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Install Python tools (Black with Jupyter, Bandit, Ruff)
run: pip install "black[jupyter]" bandit ruff
- name: Auto-fix Formatting Issues with Black
run: black .
- name: Auto-fix Linting Errors with Ruff
run: ruff --fix .
- name: Security Check with Bandit
run: bandit -r .
# Commit and push changes made by Black and Ruff
- name: Commit and push if changed
env:
MY_GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }}
run: |
git config --global user.name 'github-actions'
git config --global user.email '[email protected]'
git add -A
git commit -m "Automated code quality fixes" -a || echo "No changes to commit"
git push https://${MY_GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git HEAD:${GITHUB_REF_NAME}