






























@@ -63,18 +63,43 @@ jobs:
6363working-directory: publish
6464run: |
6565 set -euo pipefail
66+ remote_source_sha() {
67+ git show refs/remotes/origin/main:.openclaw-sync/source.json 2>/dev/null \
68+ | node -e 'const fs = require("node:fs"); try { const data = JSON.parse(fs.readFileSync(0, "utf8")); if (data.sha) process.stdout.write(data.sha); } catch {}' \
69+ || true
70+ }
71+72+ skip_stale_source() {
73+ current_source_sha="$(remote_source_sha)"
74+ if [ -z "$current_source_sha" ] || [ "$current_source_sha" = "$GITHUB_SHA" ]; then
75+ return
76+ fi
77+78+ if git -C "$GITHUB_WORKSPACE" merge-base --is-ancestor "$GITHUB_SHA" "$current_source_sha"; then
79+ echo "Skipping stale publish sync for $GITHUB_SHA; origin/main already mirrors $current_source_sha."
80+ exit 0
81+ fi
82+ }
83+6684 if git diff --quiet -- docs .openclaw-sync; then
6785 echo "No publish-repo changes."
6886 exit 0
6987 fi
708889+ if git fetch origin main:refs/remotes/origin/main; then
90+ skip_stale_source
91+ fi
92+7193 git config user.name "openclaw-docs-sync[bot]"
7294 git config user.email "openclaw-docs-sync[bot]@users.noreply.github.com"
7395 git add docs .openclaw-sync
7496 git commit -m "chore(sync): mirror docs from $GITHUB_REPOSITORY@$GITHUB_SHA"
7597 for attempt in 1 2 3 4 5; do
76- if git fetch origin main && git rebase origin/main && git push origin HEAD:main; then
77- exit 0
98+ if git fetch origin main:refs/remotes/origin/main; then
99+ skip_stale_source
100+ if git rebase origin/main && git push origin HEAD:main; then
101+ exit 0
102+ fi
78103 fi
79104 git rebase --abort >/dev/null 2>&1 || true
80105 echo "Publish sync attempt ${attempt} failed; retrying."
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。