summaryrefslogtreecommitdiffstats
path: root/.github/workflows
diff options
context:
space:
mode:
authorAustin S. Hemmelgarn <austin@netdata.cloud>2023-02-23 09:53:33 -0500
committerGitHub <noreply@github.com>2023-02-23 09:53:33 -0500
commitfffd076e3403c7e59e79e06cb5cd07c5850d097a (patch)
treea5cf3fd52d0cd4b46a2b7d78184fad04d112a8fb /.github/workflows
parentd7ca7f501031c78384dd5d1eac7cab152bc97946 (diff)
Add flake8 to review CI to check Python files. (#14582)
* Add flake8 to review CI to check Python files. We used to have this in our old Travis jobs, but it got removed at some point before the switch to GitHub Actions and we never re-added it. * Fix typo.
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/review.yml33
1 files changed, 33 insertions, 0 deletions
diff --git a/.github/workflows/review.yml b/.github/workflows/review.yml
index 7f12aeecdc..e6f74886f4 100644
--- a/.github/workflows/review.yml
+++ b/.github/workflows/review.yml
@@ -16,6 +16,7 @@ jobs:
outputs:
actionlint: ${{ steps.actionlint.outputs.run }}
eslint: ${{ steps.eslint.outputs.run }}
+ flake8: ${{ steps.flake8.outputs.run }}
hadolint: ${{ steps.hadolint.outputs.run }}
shellcheck: ${{ steps.shellcheck.outputs.run }}
yamllint: ${{ steps.yamllint.outputs.run }}
@@ -47,6 +48,17 @@ jobs:
else
echo "run=false" >> "${GITHUB_OUTPUT}"
fi
+ - name: Check files for flake8
+ id: flake8
+ run: |
+ if [ "${{ contains(github.event.pull_request.labels.*.name, 'run-ci/flake8') }}" = "true" ]; then
+ echo "run=true" >> "${GITHUB_OUTPUT}"
+ elif git diff --name-only origin/${{ github.base_ref }} HEAD | grep -Eq '.*\.py' ; then
+ echo "run=true" >> "${GITHUB_OUTPUT}"
+ echo 'Python files have changed, need to run flake8.'
+ else
+ echo "run=false" >> "${GITHUB_OUTPUT}"
+ fi
- name: Check files for hadolint
id: hadolint
run: |
@@ -118,6 +130,27 @@ jobs:
reporter: github-pr-check
eslint_flags: '.'
+ flake8:
+ name: flake8
+ needs: prep-review
+ if: needs.prep-review.outputs.flake8 == 'true'
+ runs-on: ubuntu-latest
+ steps:
+ - name: Git clone repository
+ uses: actions/checkout@v3
+ with:
+ submodules: recursive
+ fetch-depth: 0
+ - name: Setup Python
+ uses: actions/setup-python@v4
+ with:
+ python-version: "3.10"
+ - name: Run flake8
+ uses: reviewdog/action-flake8@v3
+ with:
+ github_token: ${{ secrets.GITHUB_TOKEN }}
+ reporter: github-pr-check
+
hadolint:
name: hadolint
needs: prep-review