Skip to content

Commit d55ac38

Browse files
authored
Add GitHub workflow for check Python file formatting (#65482)
Using darker which is doing black on diffs, similar to git-clang-format.
1 parent 38750d7 commit d55ac38

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: "Check Python Formatting"
2+
on:
3+
pull_request:
4+
# run on .py
5+
paths:
6+
- '**.py'
7+
8+
jobs:
9+
python_formatting:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Fetch LLVM sources
13+
uses: actions/checkout@v4
14+
with:
15+
persist-credentials: false
16+
fetch-depth: 2
17+
18+
- name: Get changed files
19+
id: changed-files
20+
uses: tj-actions/changed-files@v39
21+
with:
22+
files: '**/*.py'
23+
24+
- name: "Listed files"
25+
run: |
26+
echo "Formatting files:"
27+
echo "${{ steps.changed-files.outputs.all_changed_files }}"
28+
29+
- name: Setup Python env
30+
uses: actions/setup-python@v4
31+
with:
32+
python-version: '3.11'
33+
34+
- name: Python Formatting
35+
uses: akaihola/[email protected]
36+
with:
37+
options: "--check --diff --color"
38+
version: "~=1.7.2"
39+
src: "${{ steps.changed-files.outputs.all_changed_files }}"

0 commit comments

Comments
 (0)