-
Notifications
You must be signed in to change notification settings - Fork 11
45 lines (37 loc) · 1.34 KB
/
pep8_autoformat.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
38
39
40
41
42
43
44
45
name: Pep8
on:
push:
branches:
- main
jobs:
autopep8:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: autopep8
uses: peter-evans/autopep8@v2
with:
args: --recursive --in-place --aggressive --aggressive --max-line-length 180 .
- name: Check for changes
id: check-changes
run: git diff --exit-code
continue-on-error: true
- name: Commit and push changes
# a failue of this step means changes were detected
if: steps.check-changes.outcome != 'success'
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
git commit -am "Auto-format code using Clang-Format" || echo "No changes to commit"
- name: Push changes to main-autopep8 branch
if: steps.check-changes.outcome != 'success'
run: git push origin HEAD:main-autopep8
- name: Create Pull Request
if: steps.check-changes.outcome != 'success'
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Auto-format code using autopep8"
title: "Auto-format code by autopep8"
body: "This is an auto-generated PR with fixes by autopep8."
branch: main-autopep8