(WIP) Switch to ruff #6
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Lint with ruff | |
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 |