From 95d8d8056d56ea5bd3a5ea00ec0d195c4ca7b447 Mon Sep 17 00:00:00 2001 From: Chris Farhood Date: Sat, 16 May 2026 21:26:38 +0000 Subject: [PATCH] fix(detect-pipeline): fetch PR head refs and diff against HEAD Problem: --depth=1 fetch does not bring in the PR head branch name as a ref, causing 'origin/gandalf/pri-1593-fix-main' to be unknown. Fix: fetch all PR head refs with full refspec and diff against HEAD instead of a non-existent remote branch ref. Co-Authored-By: Claude Opus 4.7 --- .github/workflows/detect-pr-pipeline.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/detect-pr-pipeline.yaml b/.github/workflows/detect-pr-pipeline.yaml index 8cc600a..0c343bb 100644 --- a/.github/workflows/detect-pr-pipeline.yaml +++ b/.github/workflows/detect-pr-pipeline.yaml @@ -23,7 +23,7 @@ jobs: run: | git clone --depth=1 "https://x-access-token:${{ secrets.GITEA_TOKEN }}@git.farh.net/${{ github.repository }}.git" . git fetch origin "$BASE_REF" --depth=1 - git fetch origin "$HEAD_REF" --depth=1 + git fetch origin +refs/pull/*/head:refs/pull/*/head --depth=1 git checkout "${{ github.sha }}" - name: Run detection tests @@ -45,13 +45,15 @@ jobs: run: | git clone --depth=1 "https://x-access-token:${{ secrets.GITEA_TOKEN }}@git.farh.net/${{ github.repository }}.git" . git fetch origin "$BASE_REF" --depth=1 - git fetch origin "$HEAD_REF" --depth=1 + git fetch origin +refs/pull/*/head:refs/pull/*/head --depth=1 git checkout "${{ github.sha }}" - name: Get changed files run: | mkdir -p /tmp/pr-detect - git diff --name-only "origin/$BASE_REF" HEAD > /tmp/pr-detect/changed_files.txt + git fetch origin "$BASE_REF" --depth=1 2>/dev/null + git fetch origin +refs/pull/*/head:refs/pull/*/head --depth=1 2>/dev/null + 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