File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Check Python Code Formatting
2+
3+ on :
4+ pull_request :
5+ branches :
6+ - main
7+
8+ jobs :
9+ format-check :
10+ runs-on : ubuntu-latest
11+
12+ steps :
13+ - name : Checkout code
14+ uses : actions/checkout@v4
15+ with :
16+ persist-credentials : false
17+
18+ - name : Set up Python
19+ uses : actions/setup-python@v5
20+ with :
21+ python-version : " 3.12.x"
22+
23+ - name : Install Black
24+ run : pip install black
25+
26+ - name : Run Black
27+ run : black .
28+
29+ - name : Commit changes if formatting is needed
30+ run : |
31+ git config --local user.name "github-actions[bot]"
32+ git config --local user.email "github-actions[bot]@users.noreply.github.com"
33+ git add .
34+ git diff --cached --exit-code || git commit -m "Auto-format code with Black"
35+
36+ - name : Push changes back to the pull request branch
37+ uses : gr2m/create-or-update-pull-request-action@v1
38+ env :
39+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
You can’t perform that action at this time.
0 commit comments