Skip to content

Commit 38e4da6

Browse files
committed
Fix checkout depth
1 parent 8a84ac9 commit 38e4da6

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

.github/workflows/test.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,12 @@ jobs:
4848
id: changed-files
4949
run: |
5050
if [ "${{ github.event_name }}" == "pull_request" ]; then
51-
# Fetch only the base commit we need
52-
git fetch origin ${{ github.event.pull_request.base.sha }} --depth=1
53-
BASE_COMMIT=${{ github.event.pull_request.base.sha }}
54-
HEAD_COMMIT=${{ github.event.pull_request.head.sha }}
51+
git fetch origin ${{ github.event.pull_request.base.ref }}:refs/remotes/origin/${{ github.event.pull_request.base.ref }} --depth=50
52+
BASE_COMMIT=$(git merge-base HEAD origin/${{ github.event.pull_request.base.ref }})
53+
HEAD_COMMIT=HEAD
54+
echo "Base branch: ${{ github.event.pull_request.base.ref }}"
55+
echo "Base commit (merge-base): $BASE_COMMIT"
56+
echo "Head commit: $HEAD_COMMIT"
5557
CHANGED_FILES=$(git diff --name-only --diff-filter=ACMR $BASE_COMMIT..$HEAD_COMMIT | grep '\.sol$' || true)
5658
else
5759
CHANGED_FILES=$(git diff --name-only --diff-filter=ACMR HEAD^..HEAD | grep '\.sol$' || true)

0 commit comments

Comments
 (0)