From a4b1d0e2f14c92d39671d07427912177d098e983 Mon Sep 17 00:00:00 2001 From: John Zhang Date: Wed, 19 Feb 2025 17:13:45 +0800 Subject: [PATCH 1/3] Create eslint.yml --- .github/workflows/eslint.yml | 58 ++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/eslint.yml diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml new file mode 100644 index 0000000..8fe4bf8 --- /dev/null +++ b/.github/workflows/eslint.yml @@ -0,0 +1,58 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# ESLint is a tool for identifying and reporting on patterns +# found in ECMAScript/JavaScript code. +# More details at https://github.com/eslint/eslint +# and https://eslint.org + +name: ESLint + +on: + push: + branches: [ "main" ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ "main" ] + schedule: + - cron: '44 23 * * 3' + +jobs: + eslint: + name: Run eslint scanning + runs-on: ubuntu-latest + permissions: + contents: read + security-events: write + actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + + - name: Setup Pnpm + uses: pnpm/action-setup@v4 + with: + run_install: false + + - name: Install dependencies + run: pnpm install --no-frozen-lockfile + + - name: Run ESLint + env: + SARIF_ESLINT_IGNORE_SUPPRESSED: "true" + run: npx eslint . + --config eslint.config.mjs + --ext .ts,.tsx + --format @microsoft/eslint-formatter-sarif + --output-file eslint-results.sarif + continue-on-error: true + + - name: Upload analysis results to GitHub + uses: github/codeql-action/upload-sarif@v3 + with: + sarif_file: eslint-results.sarif + wait-for-processing: true From cdd8d0db8a25c2c85cf1311c563254b42ccdcc7a Mon Sep 17 00:00:00 2001 From: John Zhang Date: Wed, 19 Feb 2025 17:17:31 +0800 Subject: [PATCH 2/3] chore: eslint yml --- .github/workflows/eslint.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml index 8fe4bf8..e7cb164 100644 --- a/.github/workflows/eslint.yml +++ b/.github/workflows/eslint.yml @@ -11,10 +11,10 @@ name: ESLint on: push: - branches: [ "main" ] + branches: ['main'] pull_request: # The branches below must be a subset of the branches above - branches: [ "main" ] + branches: ['main'] schedule: - cron: '44 23 * * 3' @@ -43,10 +43,8 @@ jobs: - name: Run ESLint env: - SARIF_ESLINT_IGNORE_SUPPRESSED: "true" - run: npx eslint . - --config eslint.config.mjs - --ext .ts,.tsx + SARIF_ESLINT_IGNORE_SUPPRESSED: 'true' + run: pnpm lint . --format @microsoft/eslint-formatter-sarif --output-file eslint-results.sarif continue-on-error: true From 932f871e05624de6441f7f5a05d6a3b684f4973c Mon Sep 17 00:00:00 2001 From: John Zhang Date: Wed, 19 Feb 2025 17:19:13 +0800 Subject: [PATCH 3/3] chore: eslint yml --- .github/workflows/eslint.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml index e7cb164..70024fe 100644 --- a/.github/workflows/eslint.yml +++ b/.github/workflows/eslint.yml @@ -39,12 +39,12 @@ jobs: run_install: false - name: Install dependencies - run: pnpm install --no-frozen-lockfile + run: pnpm install --no-frozen-lockfile && pnpm add -D @microsoft/eslint-formatter-sarif - name: Run ESLint env: SARIF_ESLINT_IGNORE_SUPPRESSED: 'true' - run: pnpm lint . + run: pnpm lint --format @microsoft/eslint-formatter-sarif --output-file eslint-results.sarif continue-on-error: true