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:
parent
39eef53657
commit
3d50ac5aae
1 changed files with 19 additions and 1 deletions
20
.github/workflows/ci.yaml
vendored
20
.github/workflows/ci.yaml
vendored
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue