From a6fa1d1ca35d812363e0bc46cd24ae4e9f34f225 Mon Sep 17 00:00:00 2001 From: Lukas Wallrich Date: Thu, 3 Dec 2026 11:17:44 +0100 Subject: [PATCH] Staging: load a PR's files before merging it, and clean up after a failed merge Co-Authored-By: Claude Opus 5.5 --- .github/workflows/staging-aggregate.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/staging-aggregate.yaml b/.github/workflows/staging-aggregate.yaml index 74d2ff66b49..2d383806ae9 100644 --- a/.github/workflows/staging-aggregate.yaml +++ b/.github/workflows/staging-aggregate.yaml @@ -207,6 +207,12 @@ jobs: continue fi + # Check the PR out first, so that all its files are here before the merge. If some + # are missing, git can ask the server for files the merge itself has just written, + # and fail ("upload-pack: not our ref"). + git checkout -q --detach "$MERGE_REF" || echo "::warning::Loading the files of PR #$pr failed" + git checkout -q -f "$AGGREGATE_BRANCH" + # Try to merge into our aggregate branch if git merge "$MERGE_REF" --no-edit; then echo "✅ Successfully merged PR #$pr" @@ -221,6 +227,9 @@ jobs: git merge --abort else echo "::warning::Merging PR #$pr failed before conflict resolution (not a content conflict) - skipping" + # Such a merge can leave half-changed files behind, which the build would pick up. + git reset -q --hard + git clean -fdq fi fi done