Skip to content

Commit 92da6d5

Browse files
committed
ci(security): make npm audit advisory on pull requests
1 parent cdda641 commit 92da6d5

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

.github/workflows/security.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,20 @@ jobs:
2929
- name: Install dependencies
3030
run: npm ci
3131

32-
- name: NPM audit (moderate)
33-
run: npm audit --audit-level=moderate
32+
- name: NPM audit (advisory on PRs)
33+
if: github.event_name == 'pull_request'
34+
run: |
35+
set +e
36+
npm audit --audit-level=moderate
37+
code=$?
38+
set -e
39+
if [ "$code" -ne 0 ]; then
40+
echo "::warning::npm audit reported vulnerabilities (advisory mode on PRs)."
41+
fi
42+
43+
- name: NPM audit (enforced on push)
44+
if: github.event_name == 'push'
45+
run: npm audit --audit-level=critical
3446

3547
- name: Trufflehog git history scan
3648
uses: trufflesecurity/trufflehog@main

0 commit comments

Comments
 (0)