ESLint #35
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ESLint | |
on: | |
push: | |
branches: [ "master", "main" ] | |
pull_request: | |
branches: [ "master", "main" ] | |
schedule: | |
- cron: '18 13 * * 5' # Runs every Friday at 13:18 UTC | |
permissions: | |
contents: read | |
security-events: write | |
jobs: | |
eslint: | |
name: ESLint Scan | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Set Up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 'lts/*' | |
cache: 'npm' | |
- name: Cache Node Modules | |
uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install Dependencies | |
run: npm ci | |
- name: Install ESLint and SARIF Formatter | |
run: npm install [email protected] @microsoft/[email protected] | |
- name: Run ESLint Analysis | |
env: | |
SARIF_ESLINT_IGNORE_SUPPRESSED: "true" | |
run: | | |
npx eslint . \ | |
--config .eslintrc.js \ | |
--ext .js,.jsx,.ts,.tsx \ | |
--format @microsoft/eslint-formatter-sarif \ | |
--output-file eslint-results.sarif | |
continue-on-error: true | |
- name: Upload ESLint Report to GitHub | |
uses: github/codeql-action/upload-sarif@v2 | |
with: | |
sarif_file: eslint-results.sarif | |
wait-for-processing: true | |
- name: Clean Up NPM Cache | |
run: npm cache clean --force | |
if: always() |