example from https://docs.github.com/en/code-security/code-scanning/integrating-with-code-scanning/uploading-a-sarif-file-to-github#example-workflow-that-runs-the-eslint-analysis-tool
33 lines
1.2 KiB
YAML
33 lines
1.2 KiB
YAML
# https://docs.github.com/en/code-security/code-scanning/integrating-with-code-scanning/uploading-a-sarif-file-to-github#example-workflow-that-runs-the-eslint-analysis-tool
|
|
|
|
name: "ESLint analysis"
|
|
|
|
# Run workflow each time code is pushed to your repository and on a schedule.
|
|
# The scheduled workflow runs every Wednesday at 15:45 UTC.
|
|
on:
|
|
push:
|
|
schedule:
|
|
- cron: '45 15 * * 3'
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
# required for all workflows
|
|
security-events: write
|
|
# only required for workflows in private repositories
|
|
actions: read
|
|
contents: read
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Run npm install
|
|
run: npm install
|
|
# Runs the ESlint code analysis
|
|
- name: Run ESLint
|
|
# eslint exits 1 if it finds anything to report
|
|
run: node_modules/.bin/eslint build docs lib script spec-main -f node_modules/@microsoft/eslint-formatter-sarif/sarif.js -o results.sarif || true
|
|
# Uploads results.sarif to GitHub repository using the upload-sarif action
|
|
- uses: github/codeql-action/upload-sarif@v3
|
|
with:
|
|
# Path to SARIF file relative to the root of the repository
|
|
sarif_file: results.sarif
|