Bump pillow from 12.1.1 to 12.2.0 #106
This file contains hidden or 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: pre-commit (PR only on changed files) | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| permissions: | |
| contents: read | |
| jobs: | |
| detect_changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| changed: ${{ steps.changed_files.outputs.changed }} | |
| changed_python: ${{ steps.changed_python.outputs.changed_python }} | |
| steps: | |
| - name: Checkout full history | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Detect changed files | |
| id: changed_files | |
| run: | | |
| git fetch origin ${{ github.base_ref }} | |
| CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }}...HEAD) | |
| { | |
| echo "changed<<EOF" | |
| echo "$CHANGED_FILES" | |
| echo "EOF" | |
| } >> "$GITHUB_OUTPUT" | |
| - name: Detect changed Python files | |
| id: changed_python | |
| run: | | |
| git fetch origin ${{ github.base_ref }} | |
| CHANGED_PYTHON=$(git diff --name-only origin/${{ github.base_ref }}...HEAD | grep -E '\.(py|pyi|ipynb)$' || true) | |
| { | |
| echo "changed_python<<EOF" | |
| echo "$CHANGED_PYTHON" | |
| echo "EOF" | |
| } >> "$GITHUB_OUTPUT" | |
| - name: Show changed files | |
| run: | | |
| echo "Changed files:" | |
| echo "${{ steps.changed_files.outputs.changed }}" | |
| echo | |
| echo "Changed Python files:" | |
| echo "${{ steps.changed_python.outputs.changed_python }}" | |
| precommit: | |
| needs: detect_changes | |
| runs-on: ubuntu-latest | |
| if: ${{ needs.detect_changes.outputs.changed != '' }} | |
| steps: | |
| - name: Checkout PR branch | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| - name: Install tooling | |
| run: pip install pre-commit ruff | |
| - name: Run pre-commit (CI check-only stage) on changed files | |
| id: precommit_run | |
| continue-on-error: true | |
| env: | |
| CHANGED_FILES: ${{ needs.detect_changes.outputs.changed }} | |
| run: | | |
| mapfile -t files <<< "$CHANGED_FILES" | |
| pre-commit run --hook-stage manual --files "${files[@]}" --show-diff-on-failure | |
| - name: Generate Ruff Markdown report | |
| id: ruff_report | |
| if: ${{ always() && needs.detect_changes.outputs.changed_python != '' }} | |
| env: | |
| CHANGED_PYTHON: ${{ needs.detect_changes.outputs.changed_python }} | |
| run: | | |
| mkdir -p tmp | |
| mapfile -t pyfiles <<< "$CHANGED_PYTHON" | |
| python tools/ruff_report.py "${pyfiles[@]}" --output tmp/ruff-report.md | |
| - name: Add short Ruff report to GitHub Actions summary | |
| if: ${{ always() && steps.precommit_run.outcome == 'failure' && needs.detect_changes.outputs.changed_python != '' }} | |
| run: | | |
| { | |
| echo "# Lint summary" | |
| echo | |
| echo "## Ruff report (top section)" | |
| echo | |
| sed -n '1,80p' tmp/ruff-report.md | |
| echo | |
| echo "_Full report uploaded as workflow artifact: `ruff-report`_" | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| - name: Upload Ruff report artifact | |
| if: ${{ always() && needs.detect_changes.outputs.changed_python != '' }} | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: ruff-report | |
| path: tmp/ruff-report.md | |
| - name: Fail job if pre-commit failed | |
| if: ${{ steps.precommit_run.outcome == 'failure' }} | |
| run: | | |
| echo "pre-commit reported failures" | |
| exit 1 |