Skip to content

A basic janitor service to handle recurring tasks like clean up and cache updates #561

A basic janitor service to handle recurring tasks like clean up and cache updates

A basic janitor service to handle recurring tasks like clean up and cache updates #561

# This workflow will install Python dependencies and style check with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python Style Checks
on:
# Triggers the workflow on push or pull request events but only for this git branch
push:
paths-ignore:
- 'README'
- 'COPYING'
- 'NEWS'
- '*.txt'
- 'doc/**'
- 'doc-src/**'
- 'user-projects/**'
- 'state/**'
- 'certs/**'
- 'MiG-certificates/**'
- 'mig/images/**'
- 'mig/assets/**'
- 'mig/src/**'
- 'mig/apache/**'
- 'mig/bin/**'
- 'mig/java-bin/**'
branches:
- experimental
- next
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
paths-ignore:
- 'README'
- 'COPYING'
- 'NEWS'
- '*.txt'
- 'doc/**'
- 'doc-src/**'
- 'user-projects/**'
- 'state/**'
- 'certs/**'
- 'MiG-certificates/**'
- 'mig/images/**'
- 'mig/assets/**'
- 'mig/src/**'
- 'mig/apache/**'
- 'mig/bin/**'
- 'mig/java-bin/**'
branches:
- experimental
- next
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
stylecheckpython:
name: Style check python and annotate
runs-on: ubuntu-latest
steps:
- name: Check out source repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # This is necessary to get the commits
- name: Get changed python files between base and head
run: >
echo "CHANGED_FILES=$(echo $(git diff --diff-filter=ACMRTB --name-only ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} -- | grep -E '\.py$'))" >> $GITHUB_ENV
- if: ${{ env.CHANGED_FILES }}
uses: marian-code/python-lint-annotate@v4
with:
python-root-list: ${{ env.CHANGED_FILES }}
extra-pycodestyle-options: "--max-line-length=80"
extra-black-options: "--line-length=80"
extra-isort-options: "--line-length=80 -m=HANGING_INDENT"
# NOTE: we disable flake8 and pylint here to avoid overlap with lint action and limit noise
use-flake8: false
extra-flake8-options: "--max-line-length=80"
use-pylint: false
# NOTE: pylint C0209 string format suggestions requires python3.6+ so disable here
# https://pylint.pycqa.org/en/latest/user_guide/messages/convention/consider-using-f-string.html
extra-pylint-options: "--max-line-length=80 --disable=C0209"