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 <noreply@paperclip.ing>
This commit is contained in:
committed by
Gandalf the Greybeard [agent]
parent
adcce5a531
commit
c3aafc3450
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user