From 38df1e814147ab837ccbef03eff92faa4f62b0bd Mon Sep 17 00:00:00 2001 From: The412Banner Date: Tue, 22 Sep 2026 21:40:22 -0400 Subject: [PATCH] CI: full history for the pull-request merge (the depth expression came out shallow), and git's own words when a merge cannot start --- .github/workflows/build.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8e8667e107..938eff9728 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -59,7 +59,8 @@ jobs: - uses: actions/checkout@v4 with: ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }} - fetch-depth: ${{ github.event_name == 'pull_request_target' && 0 || 1 }} + # Full history: the merge below needs it (a shallow clone refuses to merge at all). + fetch-depth: 0 # The pull request as it would be once merged onto main is what gets built. When it cannot # be merged, the conflicting files and the conflicting hunks go into the run summary and the @@ -83,6 +84,19 @@ jobs: exit 0 fi FILES=$(git diff --name-only --diff-filter=U) + if [ -z "$FILES" ]; then + # The merge did not even start (git said why): quote it rather than list nothing. + { + echo "### ❌ Could not merge onto main (\`$BASE\`)" + echo + echo '```' + cat /tmp/merge.out + echo '```' + } > /tmp/pr-merge.md + cat /tmp/pr-merge.md >> "$GITHUB_STEP_SUMMARY" + echo "::error::git could not merge main: $(head -3 /tmp/merge.out | tr '\n' ' ')" + exit 1 + fi { echo "### ❌ Not mergeable — conflicts with main (\`$BASE\`)" echo