Skip to content

Commit 15b7c30

Browse files
committed
review: add retry logic for npm ci command to handle network issues
Implement shell-based retry logic (3 attempts with 5-second delays) for npm ci command to handle temporary network issues without adding external dependencies. This improvement was requested during code review to make the workflow more resilient to transient failures. Continues with existing npm install approach while adding robustness for dependency installation in GitHub Actions environment.
1 parent 8c14709 commit 15b7c30

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

.github/workflows/sdk-breaking-change-check.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,28 @@ jobs:
7878
node-version: ${{ steps.retrieve-node-version.outputs.node_version }}
7979

8080
- name: Install Node dependencies
81-
run: npm ci
81+
run: |
82+
echo "📦 Installing Node dependencies with retry logic..."
83+
84+
RETRY_COUNT=0
85+
MAX_RETRIES=3
86+
while [ $RETRY_COUNT -lt $MAX_RETRIES ]; do
87+
RETRY_COUNT=$((RETRY_COUNT + 1))
88+
echo "🔄 npm ci attempt $RETRY_COUNT of $MAX_RETRIES..."
89+
90+
if npm ci; then
91+
echo "✅ npm ci successful"
92+
break
93+
else
94+
echo "❌ npm ci attempt $RETRY_COUNT failed"
95+
[ $RETRY_COUNT -lt $MAX_RETRIES ] && sleep 5
96+
fi
97+
done
98+
99+
if [ $RETRY_COUNT -eq $MAX_RETRIES ] && ! npm ci; then
100+
echo "::error::npm ci failed after $MAX_RETRIES attempts"
101+
exit 1
102+
fi
82103
83104
- name: Download SDK artifacts
84105
env:

0 commit comments

Comments
 (0)