Skip to content

Commit 04037ae

Browse files
authored
add black style checking to GHA settings (#465)
1 parent 00f2317 commit 04037ae

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

.github/workflows/autofmt.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ jobs:
66
formatter:
77
name: auto-formatter
88
runs-on: windows-latest
9-
# Because auto-commit to the branch from a forked repository will fail,
10-
# so this GHA will be triggered by PRs from the source repository only.
11-
if: github.repository == github.event.pull_request.head.repo.full_name
129
steps:
1310
- name: Checkout
1411
uses: actions/checkout@v3
@@ -18,9 +15,19 @@ jobs:
1815
python-version: 3.7
1916
- name: Install black
2017
run: pip install black==22.12.0
21-
- name: Format
18+
# PRs from the forked repo will trigger format-checking only.
19+
# Auto-commit to the branch from a forked repo will fail without
20+
# any access tokens or permissions.
21+
# So formatting and auto-commit will be triggered by PRs from the
22+
# base repo only.
23+
- if: github.repository != github.event.pull_request.head.repo.full_name
24+
name: Check style
25+
run: python -m black comtypes/. --check --diff --color
26+
- if: github.repository == github.event.pull_request.head.repo.full_name
27+
name: Format
2228
run: python -m black comtypes/.
23-
- name: Auto-commit
29+
- if: github.repository == github.event.pull_request.head.repo.full_name
30+
name: Auto-commit
2431
uses: stefanzweifel/git-auto-commit-action@v4
2532
with:
2633
branch: ${{ github.head_ref }}

0 commit comments

Comments
 (0)