forked from MHKiT-Software/MHKiT-Python
-
Notifications
You must be signed in to change notification settings - Fork 0
34 lines (27 loc) · 882 Bytes
/
Copy pathblack.yml
File metadata and controls
34 lines (27 loc) · 882 Bytes
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
name: Black Code Formatter
on: [push, pull_request]
jobs:
black:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v6
- name: Get changed Python files
id: changed-py-files
uses: tj-actions/changed-files@v47
with:
files: |
**.py
- name: Set up Python
if: steps.changed-py-files.outputs.any_changed == 'true'
uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Install Black
if: steps.changed-py-files.outputs.any_changed == 'true'
run: |
python -m pip install --upgrade pip
pip install black
- name: Check Black Formatting
if: steps.changed-py-files.outputs.any_changed == 'true'
run: black --check ${{ steps.changed-py-files.outputs.all_changed_files }}