forked from collective/icalendar
-
Notifications
You must be signed in to change notification settings - Fork 1
48 lines (46 loc) · 1.68 KB
/
Copy pathruff-format.yml
File metadata and controls
48 lines (46 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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
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')
env:
GIT_COMMIT_MESSAGE: |
Format with ruff
See https://icalendar.readthedocs.io/en/stable/contribute/development.html#code-format
steps:
- uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
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
- name: Format the code with ruff
run: ruff format
- name: Format the code with ruff check
run: ruff check --fix
- 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"
- name: Push changes
uses: ad-m/github-push-action@v1.0.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref_name }}