Skip to content

Commit

Permalink
create yaml file for pylint under github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
armiro committed Apr 23, 2024
1 parent bce39c6 commit 887f500
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Pylint

on:
push:
branches:
- main
paths-ignore:
- '**/README.md'

jobs:
lint:
name: PyLint Check
runs-on: ubuntu-latest

steps:

- name: checkout code
uses: actions/checkout@v3

- name: setup python
uses: actions/setup-python@v3
with:
python-version: 3.9

- name: install dependencies
run: |
python -m pip install --upgrade pip
pip install -r ./requirements.txt
- name: run pylint on all python files
run: |
pylint --exit-zero $(git ls-files "*.py")
- name: run pylint score updater
run: python ./utils/pylint_score_updater.py

- name: config git user identity
run: |
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git config user.name "${GITHUB_ACTOR}"
- name: check if pylint score has changed
id: check_pylint
working-directory: ${{ github.workspace }}
run: |
set +e
diff_result=$(git diff --exit-code ./README.md)
set -e
has_changed="False"; [ -n "$diff_result" ] && has_changed="True"
echo "has_changed=$has_changed" >> $GITHUB_OUTPUT
- name: commit and push changes if any
if: ${{ steps.check_pylint.outputs.has_changed == 'True' }}
run: |
git add README.md
git commit -m "automatically update pylint score in the badge"
git push

0 comments on commit 887f500

Please sign in to comment.