-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (55 loc) · 1.79 KB
/
formatter.yml
File metadata and controls
69 lines (55 loc) · 1.79 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: Formatter
on:
pull_request:
jobs:
check-changes:
name: Check Changes
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Check Changes
uses: dorny/paths-filter@v2
id: changes
with:
filters: |
python-files:
- '**.py,**.pyi,**.ipynb'
formatter:
name: Format
needs: check-changes
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Install Node Packages
uses: ./.github/actions/install-node-packages
- name: Install Python Modules
uses: ./.github/actions/install-python-modules
- name: Run Prettier
run: npx prettier --write .
- name: Run Databooks
if: needs.changes.outputs.python-files == 'true'
run: poetry run databooks meta --rm-outs --rm-exec --yes .
- name: Run nqQA isort
if: needs.changes.outputs.python-files == 'true'
run: poetry run nbqa isort .
- name: Run nqQA pyupgrade
if: needs.changes.outputs.python-files == 'true'
run: poetry run nbqa pyupgrade .
- name: Run Black
if: needs.changes.outputs.python-files == 'true'
run: poetry run black .
- name: Cache pre-commit
uses: actions/cache@v3
id: precommit_cache_id
with:
path: ~/.cache/pre-commit
key: pre-commit-cache-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('.pre-commit-config.yaml') }}
- name: Run pre-commit
if: steps.precommit_cache_id.outputs.cache-hit != 'true'
run: poetry run pre-commit run --all-files
- name: Commit
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Formatted!