You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fory.apache.org by ch...@apache.org on 2026/08/07 09:16:48 UTC
(fory-site) 01/01: Fix archive verification on CI runners
This is an automated email from the ASF dual-hosted git repository.
chaokunyang pushed a commit to branch fix_archive
in repository https://gitbox.apache.org/repos/asf/fory-site.git
commit d5bf47efea587b9a807555cbdab0fb1bfd718d5a
Author: chaokunyang <sh...@gmail.com>
AuthorDate: Fri Aug 7 17:16:08 2026 +0800
Fix archive verification on CI runners
---
scripts/verify-docs-archive.sh | 54 ++++++++++++++++++++++++++++++++++--------
1 file changed, 44 insertions(+), 10 deletions(-)
diff --git a/scripts/verify-docs-archive.sh b/scripts/verify-docs-archive.sh
index c2d97e21c5..34fc9ab032 100755
--- a/scripts/verify-docs-archive.sh
+++ b/scripts/verify-docs-archive.sh
@@ -30,16 +30,50 @@ for version in "${ARCHIVED_VERSIONS[@]}"; do
done
# Archive pages must never depend on the mutable root-level asset hashes from
-# the current site. Keeping this invariant makes the one-time output portable.
-if rg -l "(href|src)=['\"]?/assets/" "$ARCHIVE_ROOT" --glob '*.html' >/dev/null; then
- echo "Archive HTML contains root-level /assets/ references" >&2
- rg -l "(href|src)=['\"]?/assets/" "$ARCHIVE_ROOT" --glob '*.html' | head -n 20 >&2
- exit 1
-fi
+# the current site. Use Python for this scan because GitHub's runner image does
+# not guarantee that ripgrep is installed.
+python3 - "$ARCHIVE_ROOT" <<'PY'
+import re
+import sys
+from pathlib import Path
-if ! rg -l '/archive/assets/' "$ARCHIVE_ROOT" --glob '*.html' >/dev/null; then
- echo "Archive HTML does not reference namespaced /archive/assets/ files" >&2
- exit 1
-fi
+archive_root = Path(sys.argv[1])
+unexpected_versions = []
+for docs_root in (archive_root / "docs", archive_root / "zh-CN" / "docs"):
+ for child in docs_root.iterdir():
+ if child.is_dir() and (
+ child.name == "next" or re.fullmatch(r"1[.]\d+[.]\d+", child.name)
+ ):
+ unexpected_versions.append(str(child))
+
+if unexpected_versions:
+ print("Archive contains current or 1.x docs:", file=sys.stderr)
+ for path in unexpected_versions:
+ print(path, file=sys.stderr)
+ raise SystemExit(1)
+
+root_asset_pattern = re.compile(r'''(?:href|src)=["']?/assets/''')
+root_asset_pages = []
+has_archive_assets = False
+for html_path in archive_root.rglob("*.html"):
+ html = html_path.read_text(encoding="utf-8", errors="ignore")
+ if root_asset_pattern.search(html):
+ root_asset_pages.append(str(html_path))
+ if "/archive/assets/" in html:
+ has_archive_assets = True
+
+if root_asset_pages:
+ print("Archive HTML contains root-level /assets/ references:", file=sys.stderr)
+ for path in root_asset_pages[:20]:
+ print(path, file=sys.stderr)
+ raise SystemExit(1)
+
+if not has_archive_assets:
+ print(
+ "Archive HTML does not reference namespaced /archive/assets/ files",
+ file=sys.stderr,
+ )
+ raise SystemExit(1)
+PY
echo "Verified $total_pages archived HTML pages in $ARCHIVE_ROOT"
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org
For additional commands, e-mail: commits-help@fory.apache.org