mirror of
https://github.com/wger-project/wger.git
synced 2026-12-02 10:09:21 +01:00
52 lines
1.2 KiB
YAML
52 lines
1.2 KiB
YAML
name: Automatic formatting
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- "master"
|
|
paths:
|
|
- '**.py'
|
|
- 'pyproject.toml'
|
|
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
linting:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
uses: actions/checkout@v7
|
|
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@v7
|
|
with:
|
|
enable-cache: true
|
|
|
|
- name: Get dependencies
|
|
run: uv sync --only-group dev
|
|
|
|
# --exit-zero applies whatever can be fixed and does not abort on the
|
|
# rest, otherwise a single unfixable violation (a long line, say) would
|
|
# discard the fixes that were already written to disk. Pull requests are
|
|
# gated by the ruff workflow, this job only keeps master tidy.
|
|
- name: Lint the code
|
|
run: uv run ruff check --fix --exit-zero
|
|
|
|
- name: Format the code
|
|
run: uv run ruff format
|
|
|
|
- name: Push a commit with the changed files
|
|
|
|
# Needed if no files were changed
|
|
continue-on-error: true
|
|
|
|
run: |
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
git add .
|
|
git commit -m "Automatic linting"
|
|
git push
|