Skip to content

Commit aeeccdf

Browse files
authored
fix(ci): bound ClawHub docs checkout (#87811)
1 parent 46546e6 commit aeeccdf

2 files changed

Lines changed: 56 additions & 11 deletions

File tree

‎.github/actions/detect-docs-changes/action.yml‎

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,29 @@ runs:
3535
exit 0
3636
fi
3737
38-
# Check if any changed file is a doc
39-
DOCS=$(echo "$CHANGED" | grep -E '^docs/|\.md$|\.mdx$' || true)
40-
if [ -n "$DOCS" ]; then
38+
docs_changed=false
39+
non_docs=false
40+
while IFS= read -r changed_path; do
41+
case "$changed_path" in
42+
test/fixtures/*)
43+
non_docs=true
44+
;;
45+
docs/* | *.md | *.mdx)
46+
docs_changed=true
47+
;;
48+
*)
49+
non_docs=true
50+
;;
51+
esac
52+
done <<< "$CHANGED"
53+
54+
if [ "$docs_changed" = "true" ]; then
4155
echo "docs_changed=true" >> "$GITHUB_OUTPUT"
4256
else
4357
echo "docs_changed=false" >> "$GITHUB_OUTPUT"
4458
fi
4559
46-
# Check if all changed files are docs or markdown
47-
NON_DOCS=$(echo "$CHANGED" | grep -vE '^docs/|\.md$|\.mdx$' || true)
48-
if [ -z "$NON_DOCS" ]; then
60+
if [ "$non_docs" = "false" ]; then
4961
echo "docs_only=true" >> "$GITHUB_OUTPUT"
5062
echo "Docs-only change detected — skipping heavy jobs"
5163
else

‎.github/workflows/ci.yml‎

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)