From 8205e3cf918142a55e00c00dc241a6a30914fbd9 Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Wed, 3 Apr 2024 21:12:26 +0200 Subject: GitHub: run unused imports action only for pull requests --- .github/workflows/unused-imports.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to '.github') diff --git a/.github/workflows/unused-imports.yml b/.github/workflows/unused-imports.yml index 6bb3d2cc7..83098ddf6 100644 --- a/.github/workflows/unused-imports.yml +++ b/.github/workflows/unused-imports.yml @@ -1,6 +1,7 @@ -name: Pylint - -on: [push] +name: Check for unused imports using Pylint +on: + pull_request_target: + types: [opened, reopened, ready_for_review, locked] jobs: build: @@ -20,4 +21,9 @@ jobs: pip install pylint - name: Analysing the code with pylint run: | - make unused-imports + tmp=$(git ls-files *.py | xargs pylint | grep W0611 | wc -l) + if [[ $tmp -gt 0 ]]; then + echo "Found $tmp occurrence of unused Python import statements!" + exit 1 + fi + exit 0 -- cgit v1.2.3