Skip to content

Add future reference library for research and workflow ideas #382

Add future reference library for research and workflow ideas

Add future reference library for research and workflow ideas #382

name: Auto-Fix Code Quality on Push
on:
push:
branches:
- feature/**
- development
- main
jobs:
auto-fix:
name: Auto-Fix Formatting & Linting
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
cache: 'pip'
- name: Install formatting tools
run: |
python -m pip install --upgrade pip
pip install black isort ruff
- name: Run Black formatter
run: |
black src/ tests/ scripts/ config_defaults/ || true
- name: Run isort import sorter
run: |
isort src/ tests/ scripts/ config_defaults/ || true
- name: Run Ruff auto-fixes
run: |
ruff check src/ tests/ scripts/ config_defaults/ --fix || true
- name: Check for changes
id: verify_diff
run: |
git diff --quiet . || echo "changed=true" >> $GITHUB_OUTPUT
- name: Commit auto-fixes
if: steps.verify_diff.outputs.changed == 'true'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add -A
git commit -m "style: Auto-fix code quality issues [skip ci]"
- name: Push changes
if: steps.verify_diff.outputs.changed == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}