-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create yaml file for pylint under github actions
- Loading branch information
Showing
1 changed file
with
57 additions
and
0 deletions.
There are no files selected for viewing
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
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 |