-
-
Notifications
You must be signed in to change notification settings - Fork 13
35 lines (33 loc) · 1.26 KB
/
black.yaml
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
name: Black Code Formatter
on:
push:
pull_request:
schedule:
- cron: "0 0 * * *"
jobs:
validate:
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v3
- name: black
if: github.event.pull_request.head.repo.full_name == github.repository
uses: lgeiger/black-action@master
with:
args: .
- name: Check for modified files
if: github.event.pull_request.head.repo.full_name == github.repository
id: git-check
run: echo ::set-output name=modified::$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi)
- name: Push changes
if: github.event.pull_request.head.repo.full_name == github.repository && steps.git-check.outputs.modified == 'true'
run: |
git config --global user.name 'Daniel Hoyer'
git config --global user.email '[email protected]'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
git checkout $GITHUB_HEAD_REF
git commit -am "fixup! Format Python code with black"
git push
- name: Flake8 Code Linter
uses: jonasrk/flake8-action@master
with:
args: "--max-line-length=120 "