diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml index 34390f38f..ff434071f 100644 --- a/.github/workflows/ruff.yml +++ b/.github/workflows/ruff.yml @@ -3,6 +3,11 @@ on: [push, pull_request] jobs: ruff: runs-on: ubuntu-latest + env: + MESSAGE: | + Your code is not formatted! + Please setup your development environment and run the formatting command. + https://icalendar.readthedocs.io/en/stable/contribute/development.html#code-format steps: - uses: actions/checkout@v6 - name: Set up Python @@ -15,10 +20,17 @@ jobs: python -m pip install --upgrade pip pip install . --group formatting - name: Run the ruff formatter to change files - run: ruff format --check . - - name: Run ruff checks on the files - run: ruff check --fix + run: ruff format . - name: Fail if we detect any changes on the file system run: | git status - git diff --exit-code + if ! git diff --exit-code; then + echo "$MESSAGE" + exit 1; + fi + - name: Run ruff checks on the files + run: | + if ! ruff check; then + echo "$MESSAGE" + exit 1; + fi diff --git a/CHANGES.rst b/CHANGES.rst index 745f16d9b..ad0c5660f 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -27,6 +27,7 @@ We still recommend checking out the new features and giving feedback in the repo Minor changes ~~~~~~~~~~~~~ +- Show required code changes in the CI output to help contributors solve the formatting issues. :pr:`1216` - Use ruff 0.15.0 for code formatting in :file:`tox.ini`. :pr:`1215` Breaking changes