From 9da2bd1717cf68c5aab8f609c5f3b8b88b9aa3ec Mon Sep 17 00:00:00 2001 From: Charl Smit Date: Wed, 2 Aug 2023 10:45:30 +0200 Subject: [PATCH 1/2] Add lint-action and action-eslint --- .github/workflows/lint.yml | 71 ++++++++++++++++++++++++++++++++++++ .github/workflows/linter.yml | 32 ---------------- 2 files changed, 71 insertions(+), 32 deletions(-) create mode 100644 .github/workflows/lint.yml delete mode 100644 .github/workflows/linter.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 000000000000..c1bd536d45ae --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,71 @@ +name: Lint + +on: + pull_request: + branches: + - master + +permissions: + checks: write + contents: write + +jobs: + lint-python: + name: Lint Python + runs-on: ubuntu-latest + + steps: + - name: Check out Git repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Check changed py files + id: changed-files + uses: tj-actions/changed-files@v24 + with: + files: | + **/*.py + + - name: Set up Python + uses: actions/setup-python@v1 + if: ${{ steps.changed-files.outputs.all_changed_files }} + with: + python-version: 3.8 + + - name: Install Python dependencies + if: ${{ steps.changed-files.outputs.all_changed_files }} + run: pip install flake8 + + - name: Run flake8 linter + if: ${{ steps.changed-files.outputs.all_changed_files }} + uses: wearerequired/lint-action@v2 + with: + flake8: true + flake8_auto_fix: false + flake8_args: ${{ steps.changed-files.outputs.all_changed_files }} + continue_on_error: false + + # If this is in the same step as python linting the annotations don't show up + lint-javascript: + name: Lint Javascript + runs-on: ubuntu-latest + + steps: + - name: Check out Git repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: 14 + + - name: Install Node.js dependencies + run: yarn install --frozen-lockfile + + - uses: sibiraj-s/action-eslint@v2 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + annotations: true diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml deleted file mode 100644 index 6ae2a0b799e0..000000000000 --- a/.github/workflows/linter.yml +++ /dev/null @@ -1,32 +0,0 @@ ---- -name: Lint Code Base - -on: - pull_request: - branches: [ master ] - -jobs: - build: - name: Lint Code Base - runs-on: ubuntu-latest - - permissions: - contents: read - packages: read - statuses: write - - steps: - - name: Checkout Code - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Lint Code Base - uses: super-linter/super-linter@v5 - env: - VALIDATE_ALL_CODEBASE: false - VALIDATE_JAVASCRIPT_ES: true - VALIDATE_PYTHON_FLAKE8: true - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - IGNORE_GITIGNORED_FILES: true - LINTER_RULES_PATH: / From 1935a45ecbb79ba4b2a94f2a4de9dc1d1298b260 Mon Sep 17 00:00:00 2001 From: Charl Smit Date: Thu, 3 Aug 2023 11:47:39 +0200 Subject: [PATCH 2/2] Use python 3.9 --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c1bd536d45ae..e64f30055a5b 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -31,7 +31,7 @@ jobs: uses: actions/setup-python@v1 if: ${{ steps.changed-files.outputs.all_changed_files }} with: - python-version: 3.8 + python-version: 3.9 - name: Install Python dependencies if: ${{ steps.changed-files.outputs.all_changed_files }}