-
-
Notifications
You must be signed in to change notification settings - Fork 319
Auto format code on non-protected branches. #1208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 18 commits
054e93d
98bca82
8730f15
155a7fd
21c2569
20b31c2
1ca1d99
7b3561d
9f2bc96
92a4a8d
d7128bf
b400a99
e577bab
7a30d10
8202590
0837313
f856122
5100fee
1ce254c
1272cf3
c9aaa8c
73a97fe
3c119b5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 | ||
| name: Format the code with ruff and push the changes | ||
|
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') | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. heh, and you just updated it, but my suggestion stands.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
niccokunzmann marked this conversation as resolved.
Outdated
niccokunzmann marked this conversation as resolved.
Outdated
|
||
| with: | ||
| repository: ${{ github.event.pull_request.head.repo.full_name }} | ||
| ref: ${{ github.event.pull_request.head.ref }} | ||
|
niccokunzmann marked this conversation as resolved.
Outdated
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 | ||
|
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 | ||
|
niccokunzmann marked this conversation as resolved.
niccokunzmann marked this conversation as resolved.
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" | ||
|
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 }} | ||
Uh oh!
There was an error while loading. Please reload this page.