@@ -1494,11 +1494,44 @@ jobs:
14941494 - name : Checkout ClawHub docs source
14951495 run : |
14961496 set -euo pipefail
1497- git init clawhub-source
1498- git -C clawhub-source config gc.auto 0
1499- git -C clawhub-source remote add origin "https://github.com/openclaw/clawhub.git"
1500- git -C clawhub-source fetch --no-tags --depth=1 origin "+HEAD:refs/remotes/origin/checkout"
1501- git -C clawhub-source checkout --detach refs/remotes/origin/checkout
1497+
1498+ workdir="$GITHUB_WORKSPACE/clawhub-source"
1499+ started_at="$(date +%s)"
1500+
1501+ reset_checkout_dir() {
1502+ mkdir -p "$workdir"
1503+ find "$workdir" -mindepth 1 -maxdepth 1 -exec rm -rf {} +
1504+ }
1505+
1506+ checkout_attempt() {
1507+ local attempt="$1"
1508+
1509+ reset_checkout_dir
1510+ git init "$workdir" >/dev/null
1511+ git -C "$workdir" config gc.auto 0
1512+ git -C "$workdir" remote add origin "https://github.com/openclaw/clawhub.git"
1513+
1514+ timeout --signal=TERM --kill-after=10s 30s git -C "$workdir" \
1515+ -c protocol.version=2 \
1516+ fetch --no-tags --prune --no-recurse-submodules --depth=1 origin \
1517+ "+refs/heads/main:refs/remotes/origin/checkout" || return 1
1518+
1519+ git -C "$workdir" checkout --force --detach refs/remotes/origin/checkout || return 1
1520+ echo "ClawHub checkout attempt ${attempt}/5 succeeded"
1521+ }
1522+
1523+ for attempt in 1 2 3 4 5; do
1524+ if checkout_attempt "$attempt"; then
1525+ elapsed="$(( $(date +%s) - started_at ))"
1526+ echo "ClawHub checkout completed in ${elapsed}s"
1527+ exit 0
1528+ fi
1529+ echo "ClawHub checkout attempt ${attempt}/5 failed"
1530+ sleep $((attempt * 5))
1531+ done
1532+
1533+ echo "ClawHub checkout failed after 5 attempts" >&2
1534+ exit 1
15021535
15031536 - name : Check docs
15041537 env :
0 commit comments