fix sample code #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Pylint | |
on: [push] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pylint anybadge | |
- name: Analysing the code with pylint | |
run: | | |
pylint --fail-under=0 --disable=E0401 `find -regextype egrep -regex '(.*.py)$'` | tee pylint.txt | |
- name: Upload pylint.txt as artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: pylint report | |
path: pylint.txt | |
- name: Create badge | |
run: | | |
PYLINT_SCORE=$(sed -n 's/^Your code has been rated at \([-0-9.]*\)\/.*/\1/p' pylint.txt) | |
anybadge --label=Pylint --file=pylint.svg --value=$PYLINT_SCORE 4=red 6=orange 8=yellow 9=green | |
- name: Push badge to repo | |
continue-on-error: true | |
run: | | |
mkdir -p ./.github/badges | |
cp pylint.svg ./.github/badges | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git add ./.github/badges/pylint.svg | |
git commit -m "Pylint action" | |
git push |