Skip to content

revamp pylint with anybadge #32

revamp pylint with anybadge

revamp pylint with anybadge #32

Workflow file for this run

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: 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