From 381d7cf2996362707a0e257402a63d166cbd9796 Mon Sep 17 00:00:00 2001 From: Adil Hanney Date: Sun, 12 Nov 2023 20:42:04 +0000 Subject: [PATCH] github: add eslint action --- .github/workflows/eslint.yml | 49 ++++++++++++++++++++++++++++++++++++ 1 file changed, 49 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..fdb0d21 --- /dev/null +++ b/.github/workflows/eslint.yml @@ -0,0 +1,49 @@ +name: ESLint + +on: + push: + branches: [ "main" ] + paths: + - "scripts/**" + - ".eslintrc.js" + - ".github/workflows/eslint.yml" + pull_request: + branches: [ "main" ] + paths: + - "scripts/**" + - ".eslintrc.js" + - ".github/workflows/eslint.yml" + schedule: + # Run at 1:45am every Wednesday + - cron: '45 1 * * 3' + workflow_dispatch: + +jobs: + eslint: + name: Run eslint scanning + runs-on: ubuntu-latest + permissions: + contents: read + security-events: write + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Install ESLint + run: | + npm install eslint@8.10.0 + npm install @microsoft/eslint-formatter-sarif@2.1.7 + + - name: Run ESLint + run: npx eslint scripts + --config .eslintrc.js + --ext .js,.jsx,.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@v2 + with: + sarif_file: eslint-results.sarif + wait-for-processing: true