-
Notifications
You must be signed in to change notification settings - Fork 1.6k
36 lines (30 loc) · 1021 Bytes
/
black_format.yml
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
name: Black Code Formatter
on:
pull_request:
paths:
- '**.py'
workflow_dispatch:
jobs:
black-check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: "Setup Python, Poetry and Dependencies"
uses: packetcoders/action-setup-cache-python-poetry@main
with:
python-version: "3.11"
poetry-version: "1.7.1"
install-args: "-E dev" # TODO: change this to --group dev when PR #842 lands
- name: Run Black
run: poetry run black --check . -l 140
# (Optional) If you want to automatically fix formatting issues
# Uncomment the following steps:
# - name: Auto-fix with Black and commit
# if: failure()
# run: |
# black .
# git config --local user.email "action@github.com"
# git config --local user.name "GitHub Action"
# git commit -am "Apply Black formatting" || echo "No changes to commit"
# git push