chores: refactor for the new ai research, add linter, gh action, etc (#27)

This commit is contained in:
Marina von Steinkirch, PhD 2025-08-13 21:49:46 +08:00 committed by von-steinkirch
parent fb4ab80dc3
commit d5467e559f
40 changed files with 5177 additions and 2476 deletions

0
.github/.keep vendored Normal file
View file

68
.github/workflows/auto-fix.yml vendored Normal file
View file

@ -0,0 +1,68 @@
name: 👾 auto-fix code quality
on:
pull_request:
branches: [ main, master ]
push:
branches: [ main, master ]
workflow_dispatch: # allow manual triggering
jobs:
auto-fix:
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # full history for better diff detection
- name: set up python
uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pip'
- name: install dependencies
run: |
python -m pip install --upgrade pip
pip install -r scripts/requirements.txt
- name: install code quality tools
run: |
pip install black isort autopep8 autoflake
- name: run auto-fix script
run: |
python scripts/auto_fix.py
- name: check for changes
id: check_changes
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "changes=true" >> $GITHUB_OUTPUT
echo "files were modified by auto-fix script"
git status --porcelain
else
echo "changes=false" >> $GITHUB_OUTPUT
echo "no files were modified"
fi
- name: commit and push changes (if any)
if: steps.check_changes.outputs.changes == 'true'
run: |
git config --local user.email "action@github.com"
git config --local user.name "github action"
git add -a
git commit -m "🔧 auto-fix code quality issues
- applied black formatting
- organized imports with isort
- fixed code style with autopep8
- removed unused imports with autoflake
- fixed markdown formatting
- validated and fixed links
- removed trailing whitespace
auto-generated by github actions"
git push