diff options
-rw-r--r-- | .flake8 | 2 | ||||
-rw-r--r-- | .github/workflows/review.yml | 33 |
2 files changed, 35 insertions, 0 deletions
diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000000..aa079ec57f --- /dev/null +++ b/.flake8 @@ -0,0 +1,2 @@ +[flake8] +max-line-length=120 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 |