Skip to content

Add LeetCode 3070 solution (#68) #23

Add LeetCode 3070 solution (#68)

Add LeetCode 3070 solution (#68) #23

Workflow file for this run

name: Pylint
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
pylint:
runs-on: ubuntu-latest
env:
PYLINT_FAIL_UNDER: "10.0"
strategy:
matrix:
python-version: ["3.10", "3.11"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[dev,reporter] pylint
- name: Collect changed Python files
id: changed-python
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
base_sha="${{ github.event.pull_request.base.sha }}"
head_sha="${{ github.event.pull_request.head.sha }}"
else
base_sha="${{ github.event.before }}"
head_sha="${{ github.sha }}"
fi
if [ -z "$base_sha" ] || [ "$base_sha" = "0000000000000000000000000000000000000000" ]; then
base_sha="$(git rev-list --max-parents=0 "$head_sha")"
fi
python_files="$(
git diff --name-only --diff-filter=ACMR "$base_sha" "$head_sha" -- '*.py' \
':(exclude)archive/**' | tr '\n' ' '
)"
echo "files=$python_files" >> "$GITHUB_OUTPUT"
- name: Analyse changed Python files with pylint
if: steps.changed-python.outputs.files != ''
run: |
pylint --jobs=1 --fail-under="$PYLINT_FAIL_UNDER" ${{ steps.changed-python.outputs.files }}
- name: Skip pylint when no changed Python files were found
if: steps.changed-python.outputs.files == ''
run: |
echo "No changed Python files to lint."