-
Notifications
You must be signed in to change notification settings - Fork 37
45 lines (45 loc) · 1.38 KB
/
py.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: Python checks
on:
pull_request:
types: [review_requested]
branches:
- "*"
workflow_dispatch:
inputs:
placeholder:
description: "placeholder, no effect"
required: false
jobs:
check_license_and_format:
name: License and format
runs-on: ubuntu-18.04
if: github.event.pull_request.draft == false && contains(github.event.pull_request.requested_reviewers.*.login, 'oneflow-ci-bot')
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Check Python format
id: py_check
run: |
python3 -m pip install black==19.10b0
python3 ci/check/run_py_format.py --source_dir $PWD
- name: Run Python Format
id: py_fmt
if: ${{ failure() }}
run: |
python3 -m pip install black==19.10b0
python3 ci/check/run_py_format.py --source_dir $PWD --fix
- name: Git push
id: git_push
if: ${{ failure() }}
run: |
git config --global user.email "[email protected]"
git config --global user.name "oneflow-ci-bot"
git add -u
git commit -m "auto format by CI"
git push
- name: Please request CI again
if: ${{ failure() }}
run: |
exit 1