--- name: Ruff Lint on: pull_request jobs: ruff-lint: runs-on: ubuntu-latest permissions: pull-requests: write contents: read steps: - name: Checkout Head uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ github.event.pull_request.head.ref }} repository: ${{ github.event.pull_request.head.repo.full_name }} - name: Filter changed Python files id: py-filter uses: dorny/paths-filter@v3 with: list-files: shell filters: | python: - '**/*.py' - name: Install ruff if: steps.py-filter.outputs.python == 'true' run: | pip install ruff==0.6.4 - name: Run ruff check on changed files if: steps.py-filter.outputs.python == 'true' run: | ruff check ${{ steps.py-filter.outputs.python_files }} - name: Run ruff format on changed files if: always() && steps.py-filter.outputs.python == 'true' run: | ruff format --diff ${{ steps.py-filter.outputs.python_files }}