77 pull_request :
88 types : [opened, synchronize, reopened]
99
10- concurrency :
11- group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
12- cancel-in-progress : ${{ github.ref != 'refs/heads/main' }}
13-
1410jobs :
1511 fix :
1612 name : Check Ruff Fix
@@ -37,43 +33,17 @@ jobs:
3733 - name : Install dependencies
3834 run : uv sync --dev -p .venv --extra dev
3935 - name : Ruff Check
40- id : ruff_check
41- continue-on-error : true
42- run : ruff check --fix-only --exit-non-zero-on-fix
43- - name : Create or update Ruff auto-fix PR
44- if : steps.ruff_check.outcome == 'failure' && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
45- uses : peter-evans/create-pull-request@v7
46- with :
47- token : ${{ secrets.GITHUB_TOKEN }}
48- commit-message : " fix: ruff auto-fix for #${{ github.event.pull_request.number }}"
49- branch : ci/ruff-autofix/pr-${{ github.event.pull_request.number }}
50- base : ${{ github.event.pull_request.head.ref }}
51- title : " fix: ruff auto-fix for #${{ github.event.pull_request.number }}"
52- body : |
53- Auto-generated Ruff fixes for #${{ github.event.pull_request.number }}.
54-
55- Source PR: #${{ github.event.pull_request.number }}
56- Source SHA: `${{ github.event.pull_request.head.sha }}`
57-
58- This PR targets `${{ github.event.pull_request.head.ref }}` and is kept as a rolling branch.
59- It will be auto-closed when the source PR is merged.
60- delete-branch : true
61- - name : Fail when Ruff fixes are needed
62- if : steps.ruff_check.outcome == 'failure'
6336 run : |
64- echo ""
65- echo "❌ Ruff found issues that can be fixed automatically."
66- echo ""
67- if [ "${{ github.event_name }}" = "pull_request" ] && [ "${{ github.event.pull_request.head.repo.full_name }}" = "${{ github.repository }}" ]; then
68- echo "💡 A rolling Ruff auto-fix PR to this PR branch has been created or updated."
69- else
70- echo "💡 Auto-fix PR creation was skipped (fork or non-PR event)."
71- fi
72- echo ""
73- echo "To fix locally, run:"
74- echo " pre-commit run --all-files"
75- echo "Then commit and push the changes."
76- exit 1
37+ ruff check --fix-only --diff --exit-non-zero-on-fix || (
38+ echo ""
39+ echo "❌ Ruff found issues that can be fixed automatically."
40+ echo "💡 To fix them locally, run:"
41+ echo ""
42+ echo " pre-commit run --all-files"
43+ echo ""
44+ echo "Then commit and push the changes."
45+ exit 1
46+ )
7747
7848 test :
7949 name : Run Tests
0 commit comments