-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (48 loc) · 1.58 KB
/
black_n_pylint.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
# This workflow runs pylint and updates badge
name: pylint
on:
pull_request:
branches:
- "main"
- "master"
- "develop"
jobs:
black-n-pylint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black lyncs_setuptools[pylint]
- name: Applying black formatting
run: |
black --diff .
black .
- name: Pushing changes if any
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Applying black formatting (from Github Action)
commit_user_name: sbacchio
commit_user_email: [email protected]
commit_author: Simone Bacchio <[email protected]>
- name: Pylint output
run: |
badge=$(lyncs_pylint_badge --disable=import-error . | sed "s/\&/\\\&/g")
test ! -z "$badge"
badge_line=$(awk '/!\[pylint\]/ {print FNR}' README.md)
test ! -z "$badge_line"
sed -i "${badge_line}s#.*#${badge}#" README.md
- name: Pushing changes if any
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Updating pylint score (from Github Action)
commit_user_name: sbacchio
commit_user_email: [email protected]
commit_author: Simone Bacchio <[email protected]>