-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (43 loc) · 1.48 KB
/
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
name: Pylint
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Set up Python virtual environment
run: |
python -m venv venv
source venv/bin/activate
- name: Upgrade pip and install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pylint
- name: Set PYTHONPATH
run: echo "PYTHONPATH=$(pwd)" >> $GITHUB_ENV
- name: Analysing the code with pylint
run: |
pylint $(git ls-files '*.py') | tee pylint-output.txt
score=$(tail -2 pylint-output.txt | grep -oP '[0-9\.]+/10' | cut -d'/' -f1)
echo "PYLINT_SCORE=$score" >> $GITHUB_ENV
- name: Install Anybadge
run: pip install anybadge
- name: Create badges directory
run: mkdir -p badges
- name: Generate Pylint Badge
run: anybadge --value=${{ env.PYLINT_SCORE }} --file=badges/pylint.svg pylint
- name: Commit and push badge
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add badges/pylint.svg
git commit -m "Add pylint badge" || echo "No changes to commit"
git push