summaryrefslogtreecommitdiff
path: root/.github/workflows
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-04-03 21:12:26 +0200
committerChristian Breunig <christian@breunig.cc>2024-04-03 21:16:52 +0200
commitca84e6845e6cfeb5f4f5798594b390afb735901f (patch)
tree41d00cfaa2c1a5d1c42a942566fe8ea61e4b48c5 /.github/workflows
parent8c2103038480f2256cafc977c12c75a6172e4c9f (diff)
downloadvyos-1x-ca84e6845e6cfeb5f4f5798594b390afb735901f.tar.gz
vyos-1x-ca84e6845e6cfeb5f4f5798594b390afb735901f.zip
GitHub: run unused imports action only for pull requests
(cherry picked from commit 8205e3cf918142a55e00c00dc241a6a30914fbd9)
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/unused-imports.yml14
1 files changed, 10 insertions, 4 deletions
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