Staging: survive a failed merge and load a PR's files before merging
When #943 was taken out of draft, the staging build failed. It would have failed for every other PR too, so #943 is a draft again until this is merged.
Two faults in the aggregate step:
- A merge can fail on a missing object. The clone has no file contents until Git needs them. While merging #943, Git asked the server for a file the merge had just written itself ("upload-pack: not our ref"). Checking the PR out first loads its files, so the merge has nothing left to fetch.
- A failed merge leaves files behind. Such a merge stops after deleting some files and before recording that a merge is in progress, so nothing undid it and Hugo built a mix ("template for shortcode ga_map not found"). The step now resets the tree.
Tested with the same sequence of PRs on a GitHub runner, without pushing or deploying (run): without the checkout the merge of #943 fails as before, with it Git reports a normal conflict and aborts cleanly. After a failed merge, the reset leaves a clean tree.
Staging will then report #943 as conflicting, because it and #1226 both add .github/workflows/script-tests.yaml and edit the workflows README. The other PRs build as before.
š¤ Generated with Claude Code
Summary by cubic
Fixes the staging aggregate step so a PR that fails to merge cleanly no longer breaks the build, and merging a PR no longer fails when its files are not yet in the local clone.
- Checks out each PR's files before merging so Git never asks the server for objects the merge just wrote.
- Resets and cleans the work tree after a merge that fails before conflict resolution, so the build does not see half-applied changes.