Skip to content

Commit

Permalink
add black style checking to GHA settings (#465)
Browse files Browse the repository at this point in the history
  • Loading branch information
junkmd authored Jan 8, 2023
1 parent 00f2317 commit 04037ae
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions .github/workflows/autofmt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ jobs:
formatter:
name: auto-formatter
runs-on: windows-latest
# Because auto-commit to the branch from a forked repository will fail,
# so this GHA will be triggered by PRs from the source repository only.
if: github.repository == github.event.pull_request.head.repo.full_name
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -18,9 +15,19 @@ jobs:
python-version: 3.7
- name: Install black
run: pip install black==22.12.0
- name: Format
# PRs from the forked repo will trigger format-checking only.
# Auto-commit to the branch from a forked repo will fail without
# any access tokens or permissions.
# So formatting and auto-commit will be triggered by PRs from the
# base repo only.
- if: github.repository != github.event.pull_request.head.repo.full_name
name: Check style
run: python -m black comtypes/. --check --diff --color
- if: github.repository == github.event.pull_request.head.repo.full_name
name: Format
run: python -m black comtypes/.
- name: Auto-commit
- if: github.repository == github.event.pull_request.head.repo.full_name
name: Auto-commit
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: ${{ github.head_ref }}
Expand Down

0 comments on commit 04037ae

Please sign in to comment.