Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 25 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,33 @@ jobs:
- run: pnpm test
- name: pnpm audit
run: |
# registry.npmjs.org's audit endpoint times out often enough on GitHub's
# runners that pnpm's own built-in retry (which this log already shows
# exhausting — 10s then 1min backoff) isn't always enough. Outer retry
# so a transient registry blip doesn't fail the whole build; a real
# vulnerability finding will still fail every attempt.
# registry.npmjs.org's audit endpoint is flaky on hosted runners.
# Keep failing for real audit findings, but don't fail build on
# repeated ERR_SOCKET_TIMEOUT from the upstream audit endpoint.
for i in 1 2 3; do
pnpm audit && exit 0
echo "pnpm audit attempt $i/3 failed, retrying in 30s..."
sleep 30
set +e
output="$(pnpm audit 2>&1)"
status=$?
set -e
echo "$output"

if [ "$status" -eq 0 ]; then
exit 0
fi

if echo "$output" | grep -Eq 'ERR_SOCKET_TIMEOUT|Socket timeout'; then
if [ "$i" -lt 3 ]; then
echo "pnpm audit attempt $i/3 hit registry timeout, retrying in 30s..."
sleep 30
continue
fi
echo "pnpm audit timed out after 3 attempts; not failing build on transient registry outage."
exit 0
fi

exit "$status"
done
exit 1
exit 0

audit:
if: github.event_name == 'schedule'
Expand Down
Loading