|
| 1 | +# This workflow uses actions that are not certified by GitHub. |
| 2 | +# They are provided by a third-party and are governed by |
| 3 | +# separate terms of service, privacy policy, and support |
| 4 | +# documentation. |
| 5 | +# ESLint is a tool for identifying and reporting on patterns |
| 6 | +# found in ECMAScript/JavaScript code. |
| 7 | +# More details at https://github.com/eslint/eslint |
| 8 | +# and https://eslint.org |
| 9 | + |
| 10 | +--- |
| 11 | + |
| 12 | +name: ESLint Code Scanning |
| 13 | + |
| 14 | + |
| 15 | +on: # yamllint disable-line rule:truthy |
| 16 | + push: |
| 17 | + branches: ["main"] |
| 18 | + pull_request: |
| 19 | + # The branches below must be a subset of the branches above |
| 20 | + branches: ["main"] |
| 21 | + workflow_dispatch: |
| 22 | + schedule: |
| 23 | + # ┌───────────── minute (0 - 59) |
| 24 | + # │ ┌───────────── hour (0 - 23) |
| 25 | + # │ │ ┌───────────── day of the month (1 - 31) |
| 26 | + # │ │ │ ┌───────────── month (1 - 12 or JAN-DEC) |
| 27 | + # │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT) |
| 28 | + # │ │ │ │ │ |
| 29 | + # │ │ │ │ │ |
| 30 | + # │ │ │ │ │ |
| 31 | + # * * * * * |
| 32 | + - cron: '23 15 * * 2' |
| 33 | + |
| 34 | +jobs: |
| 35 | + eslint: |
| 36 | + name: Run eslint scanning |
| 37 | + runs-on: ubuntu-24.04 |
| 38 | + permissions: |
| 39 | + contents: read |
| 40 | + security-events: write |
| 41 | + # only required for a private repository by |
| 42 | + # github/codeql-action/upload-sarif to get the Action run status |
| 43 | + actions: read |
| 44 | + steps: |
| 45 | + - name: Checkout code |
| 46 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 |
| 47 | + |
| 48 | + - name: Set up Node.js |
| 49 | + uses: actions/setup-node@v4 |
| 50 | + with: |
| 51 | + node-version: 22.x |
| 52 | + |
| 53 | + - name: Install ESLint |
| 54 | + run: | |
| 55 | + npm install --include=dev [email protected] |
| 56 | + npm install --include=dev @microsoft/[email protected] |
| 57 | +
|
| 58 | + - name: Test ESLint |
| 59 | + run: | |
| 60 | + npx --yes eslint --env-info |
| 61 | +
|
| 62 | + - name: Run ESLint |
| 63 | + run: > |
| 64 | + npx eslint . |
| 65 | + --color |
| 66 | + --max-warnings=0 |
| 67 | + --format @microsoft/eslint-formatter-sarif |
| 68 | + --output-file eslint-results.sarif |
| 69 | + continue-on-error: true |
| 70 | + |
| 71 | + - name: Upload analysis results to GitHub |
| 72 | + uses: github/codeql-action/upload-sarif@v3 |
| 73 | + with: |
| 74 | + sarif_file: eslint-results.sarif |
| 75 | + wait-for-processing: true |
0 commit comments