-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (53 loc) · 2.03 KB
/
black.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Black_formatter
on:
push:
branches:
- master
# pull_request:
# branches:
# - master
jobs:
formatter:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Check if formatting is needed
id: check-format
uses: psf/black@stable
continue-on-error: true
with:
options: "--check -t py310 -t py311"
src: "./src"
jupyter: true
version: "~= 23.11"
- name: Black formatting
# if: ${{ failure() }}
if: steps.check-format.outcome == 'failure'
uses: psf/black@stable
with:
options: "--verbose -t py310 -t py311"
src: "./src"
jupyter: true
version: "~= 23.11"
- name: Create Pull Request
# if: ${{ failure() }}
if: steps.check-format.outcome == 'failure'
uses: EndBug/add-and-commit@v9
with:
committer_name: GitHub Actions
committer_email: 41898282+github-actions[bot]@users.noreply.github.com
# author_name: ${{ github.actor }}
# author_email: ${{ github.actor }}@users.noreply.github.com
add: "./src"
message: "Ran Black formatted on python code in ./src/\n\nThere appeared to be some python formatting in ${{ github.sha }} that did not conform with Black's formatting standards. So Black(https://github.com/psf/black) formatter was used to fix these issues."
# uses: peter-evans/create-pull-request@v5
# with:
# token: ${{ secrets.GITHUB_TOKEN }}
# title: "Formatted Python code with Black"
# commit-message: "Ran Black formatted on python code in ./src/"
# body: |
# There appeared to be some python formatting in ${{ github.sha }} that did not conform with Black's formatting standards.
# So [Black](https://github.com/psf/black) formatter was used to fix these issues.
# base: ${{ github.head_ref }}
# branch: github-actions/black