From deeffc16192342e6c27e6dddd9c6e0b4b74a93de Mon Sep 17 00:00:00 2001 From: jamesread Date: Mon, 9 Sep 2024 10:40:47 +0100 Subject: [PATCH 1/5] feat: eslint GitHub Action --- .github/workflows/eslint.yaml | 41 +++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/eslint.yaml diff --git a/.github/workflows/eslint.yaml b/.github/workflows/eslint.yaml new file mode 100644 index 00000000..1e1f88f5 --- /dev/null +++ b/.github/workflows/eslint.yaml @@ -0,0 +1,41 @@ +--- +name: ESLint + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +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 + strategy: + matrix: + service: ["backend", "frontend"] + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - 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 apps/${{ matrix.service }}/ + --config .eslintrc.json + --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 c3510897238c30e6f3a7737564884acc659fbefd Mon Sep 17 00:00:00 2001 From: jamesread Date: Mon, 9 Sep 2024 10:42:28 +0100 Subject: [PATCH 2/5] feat: eslint GitHub Action --- .github/workflows/eslint.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/eslint.yaml b/.github/workflows/eslint.yaml index 1e1f88f5..90fe1d67 100644 --- a/.github/workflows/eslint.yaml +++ b/.github/workflows/eslint.yaml @@ -3,9 +3,7 @@ name: ESLint on: push: - branches: [ "main" ] pull_request: - branches: [ "main" ] jobs: eslint: @@ -24,7 +22,7 @@ jobs: - name: Install ESLint run: | - npm install eslint@8.10.0 + npm install eslint npm install @microsoft/eslint-formatter-sarif@2.1.7 - name: Run ESLint From a656e6b567ea6474c059df94c102ba22ff58c453 Mon Sep 17 00:00:00 2001 From: jamesread Date: Mon, 9 Sep 2024 11:14:25 +0100 Subject: [PATCH 3/5] feat: eslint GitHub Action --- .github/workflows/eslint.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/eslint.yaml b/.github/workflows/eslint.yaml index 90fe1d67..0d344447 100644 --- a/.github/workflows/eslint.yaml +++ b/.github/workflows/eslint.yaml @@ -29,11 +29,11 @@ jobs: run: npx eslint apps/${{ matrix.service }}/ --config .eslintrc.json --format @microsoft/eslint-formatter-sarif - --output-file eslint-results.sarif + --output-file apps/${{ matrix.service }}/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 + sarif_file: apps/${{ matrix.service }}/eslint-results.sarif wait-for-processing: true From 149b52f76fddbeaab22dd3b0226b4e51d22d11de Mon Sep 17 00:00:00 2001 From: jamesread Date: Mon, 9 Sep 2024 13:16:26 +0100 Subject: [PATCH 4/5] feat: eslint GitHub Action --- .github/workflows/eslint.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/eslint.yaml b/.github/workflows/eslint.yaml index 0d344447..13523039 100644 --- a/.github/workflows/eslint.yaml +++ b/.github/workflows/eslint.yaml @@ -27,7 +27,7 @@ jobs: - name: Run ESLint run: npx eslint apps/${{ matrix.service }}/ - --config .eslintrc.json + --config apps/${{ matrix.service }}/.eslintrc.json --format @microsoft/eslint-formatter-sarif --output-file apps/${{ matrix.service }}/eslint-results.sarif continue-on-error: true From 1909d2f2cf28339a15ec68b4fb45c949d3341977 Mon Sep 17 00:00:00 2001 From: jamesread Date: Mon, 9 Sep 2024 13:20:43 +0100 Subject: [PATCH 5/5] npm cache --- .github/workflows/eslint.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/eslint.yaml b/.github/workflows/eslint.yaml index 13523039..5eefe228 100644 --- a/.github/workflows/eslint.yaml +++ b/.github/workflows/eslint.yaml @@ -20,6 +20,14 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + - name: Setup node + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + cache-dependency-path: | + **/package-lock.json + - name: Install ESLint run: | npm install eslint