-
Notifications
You must be signed in to change notification settings - Fork 44
46 lines (37 loc) · 1.07 KB
/
format.yml
File metadata and controls
46 lines (37 loc) · 1.07 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
name: Auto Format
on:
workflow_dispatch:
permissions:
contents: write
jobs:
format:
name: Run ruff format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v4
with:
version: "latest"
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install dependencies
run: uv sync --all-extras --dev
- name: Run ruff format
run: uv run ruff format src/
- name: Check for changes
id: changes
run: |
if [ -n "$(git diff --name-only)" ]; then
echo "has_changes=true" >> $GITHUB_OUTPUT
else
echo "has_changes=false" >> $GITHUB_OUTPUT
fi
- name: Commit and push
if: steps.changes.outputs.has_changes == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add -A
git commit -m "style: run ruff format on entire codebase"
git push