chore(release): 1.2.1 #236
This file contains hidden or 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: dependency-check-npm-audit | |
| on: | |
| pull_request: | |
| paths: &shared-trigger-paths | |
| - 'package.json' | |
| - 'package-lock.json' | |
| - '.github/workflows/dependency-check-npm-audit.yaml' | |
| types: [ opened, synchronize ] | |
| push: | |
| paths: *shared-trigger-paths | |
| branches: | |
| - main | |
| - develop | |
| - release/** | |
| env: | |
| NODE_OPTIONS: "--max_old_space_size=8192" | |
| jobs: | |
| depcheck: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - name: Setup Node | |
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
| with: | |
| node-version-file: "package.json" | |
| - name: Run npm audit | |
| env: | |
| AUDIT_CI_VERSION: latest | |
| run: | | |
| # We always save the report so it's uploaded to the Security tab | |
| npx -y audit-ci@${AUDIT_CI_VERSION} --report --report-type full --config audit-ci.jsonc -o json > audit.json || true | |
| # We run it again in text mode to have a better output in the logs and let it fail if there are vulnerabilities (criticity set in audit-ci.jsonc) | |
| npx -y audit-ci@${AUDIT_CI_VERSION} --report --report-type full --config audit-ci.jsonc | |
| - name: Convert npm audit results to SARIF | |
| if: always() | |
| run: | | |
| npx npm-audit-sarif audit.json > audit.sarif.json | |
| # potentially fix levels that are not recognized by GitHub | |
| jq '(.runs[].results[] | select(.level != "none" and .level != "note" and .level != "warning" and .level != "error") | .level) |= "warning"' audit.sarif.json > fixed-audit.sarif.json | |
| mv fixed-audit.sarif.json audit.sarif.json | |
| - name: Upload SARIF file to GitHub Security tab | |
| if: always() | |
| uses: github/codeql-action/upload-sarif@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.30.5 | |
| with: | |
| sarif_file: audit.sarif.json |