File tree 1 file changed +22
-44
lines changed 1 file changed +22
-44
lines changed Original file line number Diff line number Diff line change 1
- name : Formatting
2
-
3
- on :
4
- push :
5
- branches : [ "main" ]
6
- paths-ignore :
7
- - ' **.md'
8
- - ' .github/**'
9
- - ' migrations/*'
10
- pull_request :
11
- branches : [ "main" ]
12
- paths-ignore :
13
- - ' **.md'
14
- - ' .github/**'
15
- - ' migrations/*'
16
-
1
+ name : black-action
2
+ on : [push, pull_request]
17
3
jobs :
18
- formatting :
4
+ linter_name :
5
+ name : runner / black
19
6
runs-on : ubuntu-latest
20
-
21
7
steps :
22
- - name : Checkout repository
23
- uses : actions/checkout@v2
24
-
25
- - name : Set up Python
26
- uses : actions/setup-python@v2
27
- with :
28
- python-version : ' 3.x'
29
-
30
- - name : Install black
31
- run : pip install black
32
-
33
- - name : Run black
34
- run : black .
35
-
36
- - name : Commit changes
37
- run : |
38
- git config --global user.email "[email protected] "
39
- git config --global user.name "GitHub Actions"
40
- git add .
41
- git diff-index --quiet HEAD || git commit -m "Auto-format code with Black"
42
- git push
43
- - name : Check git status after commit
44
- run : git status
45
-
46
-
47
-
8
+ - uses : actions/checkout@v2
9
+ - name : Check files using the black formatter
10
+ uses : rickstaa/action-black@v1
11
+ id : action_black
12
+ with :
13
+ black_args : " ."
14
+ - name : Create Pull Request
15
+ if : steps.action_black.outputs.is_formatted == 'true'
16
+ uses : peter-evans/create-pull-request@v3
17
+ with :
18
+ token : ${{ secrets.GITHUB_TOKEN }}
19
+ title : " Format Python code with psf/black push"
20
+ commit-message : " :art: Format Python code with psf/black"
21
+ body : |
22
+ There appear to be some python formatting errors in ${{ github.sha }}. This pull request
23
+ uses the [psf/black](https://github.com/psf/black) formatter to fix these issues.
24
+ base : ${{ github.head_ref }} # Creates pull request onto pull request or commit branch
25
+ branch : actions/black
You can’t perform that action at this time.
0 commit comments