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
|
name: Code checker
on:
push:
pull_request:
schedule:
- cron: "0 4 * * *"
jobs:
validate:
runs-on: "ubuntu-latest"
strategy:
matrix:
python-version:
- "3.10"
- "3.11"
- "3.12"
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependency
run: |
pip install aiohttp PyJWT
pip install ruff>=0.1.0
- name: Run ruff check
run: |
ruff check mill/
- name: Run ruff formatter (auto-fix)
if: github.event.pull_request.head.repo.full_name == github.repository
run: ruff format .
- name: Check for modified files
if: github.event.pull_request.head.repo.full_name == github.repository
id: git-check
run: echo "modified=$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi)" >> $GITHUB_OUTPUT
- name: Push changes
if: github.event.pull_request.head.repo.full_name == github.repository && steps.git-check.outputs.modified == 'true'
run: |
git config --global user.name 'Daniel Hoyer'
git config --global user.email 'mail@dahoiv.net'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
git fetch origin
git checkout ${{ github.head_ref || github.ref_name }}
git commit -am "fixup! Format Python code with ruff"
git push
|