Skip to content

Commit 2dd0e84

Browse files
Add linting workflow using Black for code formatting
1 parent d9cb24e commit 2dd0e84

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

.github/workflows/pre-commit.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: pre-commit
2+
3+
on: pull_request
4+
5+
jobs:
6+
black-format:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v3
10+
with:
11+
ref: ${{ github.ref }}
12+
- uses: actions/setup-python@v3
13+
- name: Install uv
14+
run: pip install uv
15+
- name: Run black via uv
16+
run: uvx black .
17+
- name: Commit and push changes
18+
run: |
19+
git config --global user.name "${{ github.actor }}"
20+
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
21+
git add .
22+
git diff --cached --quiet || git commit --amend --no-edit
23+
git push --force origin HEAD:${{ github.head_ref }}

0 commit comments

Comments
 (0)