fix(ci): bound ClawHub docs checkout (#87811) · openclaw/openclaw@aeeccdf
RomneyDa
·
2026-05-29
·
via Recent Commits to openclaw:main
File tree
actions/detect-docs-changes
| Original file line number | Diff line number | Diff line change |
|---|
@@ -35,17 +35,29 @@ runs:
|
35 | 35 | exit 0 |
36 | 36 | fi |
37 | 37 | |
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 |
41 | 55 | echo "docs_changed=true" >> "$GITHUB_OUTPUT" |
42 | 56 | else |
43 | 57 | echo "docs_changed=false" >> "$GITHUB_OUTPUT" |
44 | 58 | fi |
45 | 59 | |
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 |
49 | 61 | echo "docs_only=true" >> "$GITHUB_OUTPUT" |
50 | 62 | echo "Docs-only change detected — skipping heavy jobs" |
51 | 63 | else |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -1494,11 +1494,44 @@ jobs:
|
1494 | 1494 | - name: Checkout ClawHub docs source |
1495 | 1495 | run: | |
1496 | 1496 | 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 |
1502 | 1535 | |
1503 | 1536 | - name: Check docs |
1504 | 1537 | env: |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。