refresh: land only what the build changed, as a patch on the latest gh-pages, instead of copying a stale checkout over it
ci / test (push) Successful in 48s
sync / sync (push) Successful in 7s

A run's source checkout is taken at job start; the gh-pages checkout it commits to is taken minutes later, after
the queue and the build. Copying the whole folder reverted whatever landed in between (it just undid two commits
to Havre). Now the build's own diff is applied to the newest gh-pages, three-way; `from` keeps the whole-folder
landing, which is what it's for.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VAvUH72XsdCitHdh3t7mjr
This commit is contained in:
teahubxyzandClaude Fable 5.1 committed 2026-10-20 03:46:57 +00:00
1 parent 9aaf0ed395
commit 822cf891d3
1 file changed
+19 -5
+19 -5
View File
@@ -77,11 +77,25 @@ jobs:
run: |
set -eu
[ -f "pages/ventures/ventures.json" ] || { echo "::error::no ledger on gh-pages"; exit 1; }
rm -rf "pages/ventures/$SLUG"
cp -R "work/ventures/$SLUG" "pages/ventures/$SLUG"
find "pages/ventures/$SLUG" -name __pycache__ -type d -prune -exec rm -rf {} +
cd pages
git add --all "ventures/$SLUG"
find "work/ventures/$SLUG" -name __pycache__ -type d -prune -exec rm -rf {} +
if [ -n "$FROM" ]; then
# a rework from another branch lands whole, in place of what gh-pages has
rm -rf "pages/ventures/$SLUG"
cp -R "work/ventures/$SLUG" "pages/ventures/$SLUG"
cd pages
git add --all "ventures/$SLUG"
else
# the build's own changes only, applied to the newest gh-pages: the source was checked out minutes ago, and
# copying it whole would revert whatever landed since (it did, once)
cd work
git add --all "ventures/$SLUG"
git diff --cached --binary > ../build.patch
cd ../pages
git pull -q --rebase origin gh-pages
if [ -s ../build.patch ]; then
git apply --index --3way ../build.patch || { echo "::error::the build's changes don't apply to gh-pages as it stands now: refresh again"; exit 1; }
fi
fi
if git diff --cached --quiet; then echo "nothing changed in ventures/$SLUG"; exit 0; fi
git diff --cached --stat | tail -25
git -c user.name='github-actions[bot]' -c user.email='github-actions[bot]@users.noreply.teahub.xyz' \