Skip to content

Free, open-source 3D sculpting for Linux, macOS and Windows: dense meshes, remeshing, painting, built-in AI (image/text to 3D), Send to Unreal, game-ready LODs, Gaussian splats and OpenUSD.

Gallery drift check: through gh api, and a lookup failure says so (release_script_beta, Packages run 42261735742)

islandmed35737e2ac142
diff --git a/scripts/release.sh b/scripts/release.sh
index 74b40443..608e3e63 100755
--- a/scripts/release.sh
+++ b/scripts/release.sh
@@ -288,7 +288,10 @@ preflight() {
auth=$(gh auth status 2>&1 || true)
grep -q "account $AUTHOR_NAME" <<<"$auth" || die "gh is not logged in as $AUTHOR_NAME" "gh auth login (or gh auth switch -u $AUTHOR_NAME)"
words_ok "$mode"
- python3 tools/brush-gallery/check_published.py >/dev/null 2>&1 || die "the public gallery (islandmed/sculptforge-brushes) differs from tools/brush-gallery/repo: $(python3 tools/brush-gallery/check_published.py 2>/dev/null | head -3)" "copy tools/brush-gallery/repo into a clone of it, commit, push its main"
+ local gallery rc=0
+ gallery=$(python3 tools/brush-gallery/check_published.py 2>/dev/null) || rc=$?
+ [ $rc -ne 2 ] || die "$(head -1 <<<"$gallery")" "check the network and gh auth status, then run again"
+ [ $rc -eq 0 ] || die "the public gallery (islandmed/sculptforge-brushes) differs from tools/brush-gallery/repo: $(head -3 <<<"$gallery")" "copy tools/brush-gallery/repo into a clone of it, commit, push its main"
grep -q '^set(SCULPTFORGE_PRERELEASE "[a-z0-9.]*")$' CMakeLists.txt ||
die "CMakeLists.txt lost its set(SCULPTFORGE_PRERELEASE \"\") line that step bump sets" "restore it under project() (git log -p CMakeLists.txt), commit"
python3 -c 'import json, sys; json.load(open(sys.argv[1]))' website/latest.json 2>/dev/null || die "website/latest.json is not valid JSON" "fix it, commit"
diff --git a/tests/release_beta_test.sh b/tests/release_beta_test.sh
index 07aaddda..2e1e4f9c 100755
--- a/tests/release_beta_test.sh
+++ b/tests/release_beta_test.sh
@@ -78,6 +78,7 @@ case "\$*" in
"api repos/islandmed/SculptForge/actions/runs/77/artifacts"*)
python3 -c 'import json; print(json.dumps({"artifacts": [{"name": n} for n in "linux-x86_64 linux-arm64 flatpak-x86_64 flatpak-aarch64 vfx-vfx2026-x86_64 vfx-vfx2026-arm64 vfx-vfx2027-x86_64 vfx-vfx2027-arm64 macos windows staged-sums".split()]}))' ;;
"api repos/islandmed/SculptForge/git/ref/tags/"*) exit 1 ;; # not pushed yet
+ "api repos/islandmed/sculptforge-brushes/git/trees/main"*) python3 "$S/repo/tools/brush-gallery/check_published.py" --tree-json ;; # (published as is)
"run list"*) echo 7 ;;
"run view"*"-q .status"*) echo completed ;;
"run view"*"-q .conclusion"*) echo success ;;
diff --git a/tools/brush-gallery/check_published.py b/tools/brush-gallery/check_published.py
index 5ffad199..444389c7 100644
--- a/tools/brush-gallery/check_published.py
+++ b/tools/brush-gallery/check_published.py
@@ -7,13 +7,20 @@ The app and brushes.html read https://github.com/islandmed/sculptforge-brushes;
that never reached it left a third-party mark live for weeks, so release.sh runs this. Compares git blob hashes of
every file (no clone), then runs check_marks' patterns over repo/'s file names and text.
+The public tree comes from `gh api` (signed in: no anonymous rate limit on shared CI runners, and the release test's gh
+stand-in answers it), else from the anonymous REST API when gh isn't installed. A failed lookup is reported as such
+(on stdout, which release.sh shows), never as a difference.
+
python3 check_published.py (network; release.sh preflight)
python3 check_published.py --self-test
+ python3 check_published.py --tree-json repo/ as the API's tree answer (the release test's gh stand-in)
Standard library only.
"""
import hashlib
import json
+import shutil
+import subprocess
import sys
import urllib.request
from pathlib import Path
@@ -34,9 +41,16 @@ def local_tree():
def public_tree():
- url = f"https://api.github.com/repos/{PUBLIC}/git/trees/main?recursive=1"
- with urllib.request.urlopen(urllib.request.Request(url, headers={"Accept": "application/vnd.github+json"}), timeout=30) as r:
- tree = json.load(r)["tree"]
+ path = f"repos/{PUBLIC}/git/trees/main?recursive=1"
+ if shutil.which("gh"):
+ r = subprocess.run(["gh", "api", path], capture_output=True, text=True, timeout=60)
+ if r.returncode != 0:
+ raise RuntimeError(f"gh api {path} failed: {(r.stderr or r.stdout).strip()[:200]}")
+ tree = json.loads(r.stdout)["tree"]
+ else:
+ url = f"https://api.github.com/{path}"
+ with urllib.request.urlopen(urllib.request.Request(url, headers={"Accept": "application/vnd.github+json"}), timeout=30) as r:
+ tree = json.load(r)["tree"]
return {t["path"]: t["sha"] for t in tree if t["type"] == "blob"}
@@ -67,7 +81,15 @@ def main(argv):
assert not marks(check_marks.load_marks())
print("check_published self-test ok")
return 0
- problems = marks(check_marks.load_marks()) + differences(local_tree(), public_tree())
+ if "--tree-json" in argv:
+ print(json.dumps({"tree": [{"path": p, "type": "blob", "sha": s} for p, s in local_tree().items()]}))
+ return 0
+ try:
+ public = public_tree()
+ except Exception as e: # (network, auth, rate limit: say so, not "differs")
+ print(f"could not read {PUBLIC}'s file list: {e}")
+ return 2
+ problems = marks(check_marks.load_marks()) + differences(local_tree(), public)
for p in problems:
print(p)
if problems: