-
-
Notifications
You must be signed in to change notification settings - Fork 97
37 lines (36 loc) · 1.56 KB
/
autofmt.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
32
33
34
35
36
37
on:
pull_request:
branches: [drop_py2] # TODO: add `master`
jobs:
formatter:
name: auto-formatter
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.7
- name: Install black
run: pip install black==22.12.0
# 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/.
- 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 }}
commit_message: apply automatic formatter
commit_user_name: github-actions[bot]
commit_user_email: 41898282+github-actions[bot]@users.noreply.github.com
commit_author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>