Skip to content

(WIP) Switch to ruff #4

(WIP) Switch to ruff

(WIP) Switch to ruff #4

Workflow file for this run

name: autoruff
on:
pull_request:
branches:
- master
- "**dev"
paths:
- "**/*.py"
- "pyproject.toml"
jobs:
lint:
runs-on: ubuntu-latest
name: Lint with Ruff using Python 3.12.1
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Install poetry using pipx
run: pipx install poetry && pipx ensurepath
- uses: actions/setup-python@v5
with:
python-version: "3.12.1"
cache: "poetry"
- name: Install dependencies
run: |
poetry config virtualenvs.in-project true
poetry install --no-interaction --no-root --only linting
- name: Run Ruff formatting
run: poetry run ruff format
- name: Commit Ruff changes if any
run: |
git config user.name "$(git log -n 1 --pretty=format:%an)"
git config user.email "$(git log -n 1 --pretty=format:%ae)"
git diff-index --quiet HEAD || (git commit -am 'Apply Ruff linting fixes' && git push -f)
- name: Run Ruff formatting
run: poetry run ruff format --check