From 822cf891d350028fc6532eb007facc36d3324e98 Mon Sep 17 00:00:00 2001 From: teahubxyz Date: Tue, 20 Oct 2026 03:46:57 +0000 Subject: [PATCH] refresh: land only what the build changed, as a patch on the latest gh-pages, instead of copying a stale checkout over it 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 Claude-Session: https://claude.ai/code/session_01VAvUH72XsdCitHdh3t7mjr --- .github/workflows/refresh.yml | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/.github/workflows/refresh.yml b/.github/workflows/refresh.yml index 6e79ecf..9cbf1ed 100644 --- a/.github/workflows/refresh.yml +++ b/.github/workflows/refresh.yml @@ -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' \