From c3aafc3450e3ee066f04c36d1c611cca79e2f6c3 Mon Sep 17 00:00:00 2001 From: Chris Farhood Date: Sat, 16 May 2026 21:21:49 +0000 Subject: [PATCH] Fix HEAD_REF fetch: diff against HEAD instead of origin/HEAD_REF The shallow fetch (--depth=1) does not bring the PR head branch name as a ref, causing: fatal: ambiguous argument 'origin/gandalf/pri-1593-fix-main'. Fix: git diff origin/$BASE_REF HEAD (already checked out at github.sha) instead of git diff origin/$BASE_REF origin/$HEAD_REF Co-Authored-By: Paperclip --- .github/workflows/detect-pr-pipeline.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/detect-pr-pipeline.yaml b/.github/workflows/detect-pr-pipeline.yaml index 7f004e8..8cc600a 100644 --- a/.github/workflows/detect-pr-pipeline.yaml +++ b/.github/workflows/detect-pr-pipeline.yaml @@ -51,9 +51,7 @@ jobs: - name: Get changed files run: | mkdir -p /tmp/pr-detect - git fetch origin "$BASE_REF" --depth=1 2>/dev/null - git fetch origin "$HEAD_REF" --depth=1 2>/dev/null - git diff --name-only "origin/$BASE_REF" "origin/$HEAD_REF" > /tmp/pr-detect/changed_files.txt + git diff --name-only "origin/$BASE_REF" HEAD > /tmp/pr-detect/changed_files.txt echo "Files found: $(wc -l < /tmp/pr-detect/changed_files.txt)" cat /tmp/pr-detect/changed_files.txt