ci: auto-fix formatting in prek job

Run ruff check --fix and ruff format before prek validation.
If files were modified, commit and push the fixes automatically.
This commit is contained in:
Kevin Turcios 2026-04-09 11:48:19 -05:00
parent 39eef53657
commit 3d50ac5aae

View file

@ -167,14 +167,32 @@ jobs:
&& (needs.determine-changes.outputs.e2e == 'true'
|| needs.determine-changes.outputs.e2e_js == 'true')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- uses: astral-sh/setup-uv@v8.0.0
- name: Auto-fix formatting
run: |
uv run ruff check --fix . || true
uv run ruff format .
- name: Commit and push fixes
run: |
git diff --quiet && exit 0
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add -A
git commit -m "style: auto-format with ruff"
git push
- uses: j178/prek-action@v1
with:
extra-args: '--from-ref origin/${{ github.base_ref }} --to-ref ${{ github.sha }}'
extra-args: '--from-ref origin/${{ github.base_ref }} --to-ref HEAD'
# ---------------------------------------------------------------------------
# E2E tests — only on pull_request and workflow_dispatch (not push to main)