-
Notifications
You must be signed in to change notification settings - Fork 11
31 lines (28 loc) · 913 Bytes
/
black.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
name: Black formatting
on: [pull_request, workflow_dispatch]
jobs:
black_format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Check files using the black formatter
run: |
black --version
black --check interpax/ tests/ || black_return_code=$?
echo "BLACK_RETURN_CODE=$black_return_code" >> $GITHUB_ENV
black interpax/ tests/
- name: Annotate diff changes using reviewdog
uses: reviewdog/action-suggester@v1
with:
tool_name: blackfmt
- name: Fail if not formatted
run: |
exit ${{ env.BLACK_RETURN_CODE }}