Skip to content

Commit 996e3b3

Browse files
committed
new
Signed-off-by: TIANHE <TIANHE@GMAIL.COM>
1 parent 3f795f7 commit 996e3b3

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

.github/workflows/basic-ci.yml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,35 @@ jobs:
9595
# Project uses yarn (as specified in package.json packageManager field)
9696
# Enable corepack to use the correct yarn version
9797
corepack enable
98+
# Configure yarn registry with fallback to mirror for better reliability
99+
# Try official registry first, fallback to Taobao mirror if needed
100+
yarn config set registry https://registry.npmjs.org/ || true
101+
yarn config set network-timeout 300000 || true
98102
# IMPORTANT: skip lifecycle scripts in CI to avoid running `prepare` (husky install),
99103
# which fails because `.git` is not present in GitHub Actions checkouts by default.
100-
yarn install --frozen-lockfile --ignore-scripts
104+
# Retry logic: try up to 3 times with exponential backoff
105+
max_retries=3
106+
retry_count=0
107+
while [ $retry_count -lt $max_retries ]; do
108+
if yarn install --frozen-lockfile --ignore-scripts; then
109+
echo "✓ Dependencies installed successfully"
110+
break
111+
else
112+
retry_count=$((retry_count + 1))
113+
if [ $retry_count -lt $max_retries ]; then
114+
echo "⚠ Install failed, retrying ($retry_count/$max_retries)..."
115+
# Switch to Taobao mirror on retry for better reliability in China/network issues
116+
if [ $retry_count -eq 2 ]; then
117+
echo "Switching to Taobao mirror for retry..."
118+
yarn config set registry https://registry.npmmirror.com/ || true
119+
fi
120+
sleep $((retry_count * 5))
121+
else
122+
echo "✗ Failed to install dependencies after $max_retries attempts"
123+
exit 1
124+
fi
125+
fi
126+
done
101127
# Use --frozen-lockfile for reproducible installs. Use --ignore-scripts to keep CI non-intrusive.
102128
103129
- name: Frontend lint check

0 commit comments

Comments
 (0)