Skip to content

Commit 1b4643c

Browse files
committed
ci: tolerate audit service outages on PRs
Warn when both advisory endpoints fail without masking vulnerability findings. Keep scheduled and main-branch audits fail-closed on service errors. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: b4a13c54-417e-4b91-a9a4-08df7b66d644
1 parent dbb44cf commit 1b4643c

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

.github/workflows/dependency-audit.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,15 @@ jobs:
5858
category: npm-audit-main
5959

6060
- name: Enforce npm audit (fail on high/critical)
61+
env:
62+
EVENT_NAME: ${{ github.event_name }}
6163
run: |
64+
if jq -e '.error' npm-audit-main.json >/dev/null; then
65+
echo "::warning::npm audit advisory service unavailable after retries"
66+
test "$EVENT_NAME" = "pull_request"
67+
exit
68+
fi
6269
jq -e '
63-
(.error | not) and
6470
(.metadata.vulnerabilities.high == 0) and
6571
(.metadata.vulnerabilities.critical == 0)
6672
' npm-audit-main.json
@@ -108,9 +114,15 @@ jobs:
108114
category: npm-audit-docs
109115

110116
- name: Enforce npm audit (fail on high/critical)
117+
env:
118+
EVENT_NAME: ${{ github.event_name }}
111119
run: |
120+
if jq -e '.error' npm-audit-docs.json >/dev/null; then
121+
echo "::warning::npm audit advisory service unavailable after retries"
122+
test "$EVENT_NAME" = "pull_request"
123+
exit
124+
fi
112125
jq -e '
113-
(.error | not) and
114126
(.metadata.vulnerabilities.high == 0) and
115127
(.metadata.vulnerabilities.critical == 0)
116128
' npm-audit-docs.json

0 commit comments

Comments
 (0)