Skip to content
Closed
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/workflows/ruff-format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Automatically format the code with ruff
on:
- push

jobs:
ruff-format:
permissions:
contents: write
pull-requests: write
Comment thread
niccokunzmann marked this conversation as resolved.
name: Format the code with ruff and push the changes
Comment thread
niccokunzmann marked this conversation as resolved.
runs-on: ubuntu-latest
if: ! startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main' && ! (startsWith(github.ref, 'refs/heads/') && endsWith(github.ref, '.x')) && ! startsWith(github.ref, 'refs/heads/release')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the intent here? It would be good to add a comment and possibly a link to a reference to explain the intent of this statement, as its arguments aren't really clear. That will help make sure what you want is what you get, and help other people understand it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

heh, and you just updated it, but my suggestion stands.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, comments and purpose are in 73a97fe. Please have a look.

env:
GIT_COMMIT_MESSAGE: |
Format with ruff

See https://icalendar.readthedocs.io/en/stable/contribute/development.html#code-format
steps:
- uses: actions/checkout@v4
Comment thread
niccokunzmann marked this conversation as resolved.
Outdated
Comment thread
niccokunzmann marked this conversation as resolved.
Outdated
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
Comment thread
niccokunzmann marked this conversation as resolved.
Outdated
Comment thread
SashankBhamidi marked this conversation as resolved.
Outdated
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: 3.14
cache: pip
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install . --group formatting
Comment thread
niccokunzmann marked this conversation as resolved.
- name: Format the code with ruff
run: ruff format
- name: Format the code with ruff check
run: ruff check --fix
Comment thread
niccokunzmann marked this conversation as resolved.
Comment thread
niccokunzmann marked this conversation as resolved.
Comment thread
SashankBhamidi marked this conversation as resolved.
- name: Show the changes
run: |
git status
git diff
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -a -m "${GIT_COMMIT_MESSAGE}" || echo "No changes to commit"
Comment thread
SashankBhamidi marked this conversation as resolved.
- name: Push changes
uses: ad-m/github-push-action@v1.0.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref_name }}
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ We still recommend checking out the new features and giving feedback in the repo
Minor changes
~~~~~~~~~~~~~

- ...
- Pull requests from remote forks are formatted automatically. :pr:`1208`
Comment thread
niccokunzmann marked this conversation as resolved.
Outdated

Breaking changes
~~~~~~~~~~~~~~~~
Expand Down