@@ -17,13 +17,16 @@ jobs:
1717
1818 - name : Fetch Base Branch
1919 run : |
20- git fetch origin ${GITHUB_BASE_REF}
21- git checkout ${GITHUB_BASE_REF}
20+ # Fetch all history for the base branch and PR head
21+ git fetch origin ${{ github.base_ref }} --depth=1
22+ git fetch origin ${{ github.head_ref }} --depth=1
2223
2324 - name : Detect Added Submodules
2425 run : |
25- BASE_REF=${{github.event.pull_request.base.sha}}
26- ADDED_SUBMODULES=$(git diff --submodule ${BASE_REF}..HEAD | grep '^Submodule' | awk '{ print $2 }')
26+ BASE_REF=${{ github.event.pull_request.base.sha }}
27+ HEAD_REF=${{ github.event.pull_request.head.sha }}
28+
29+ ADDED_SUBMODULES=$(git diff --submodule ${BASE_REF}..${HEAD_REF} | grep '^Submodule' | awk '{ print $2 }')
2730 echo "Added submodules: $ADDED_SUBMODULES"
2831 echo "ADDED_SUBMODULES=$ADDED_SUBMODULES" >> $GITHUB_ENV
2932
@@ -52,13 +55,16 @@ jobs:
5255
5356 - name : Fetch Base Branch
5457 run : |
55- git fetch origin ${GITHUB_BASE_REF}
56- git checkout ${GITHUB_BASE_REF}
58+ # Fetch all history for the base branch and PR head
59+ git fetch origin ${{ github.base_ref }} --depth=1
60+ git fetch origin ${{ github.head_ref }} --depth=1
5761
5862 - name : Detect Added Submodules
5963 run : |
60- BASE_REF=${{github.event.pull_request.base.sha}}
61- ADDED_SUBMODULES=$(git diff --submodule ${BASE_REF}..HEAD | grep '^Submodule' | awk '{ print $2 }')
64+ BASE_REF=${{ github.event.pull_request.base.sha }}
65+ HEAD_REF=${{ github.event.pull_request.head.sha }}
66+
67+ ADDED_SUBMODULES=$(git diff --submodule ${BASE_REF}..${HEAD_REF} | grep '^Submodule' | awk '{ print $2 }')
6268 echo "Added submodules: $ADDED_SUBMODULES"
6369 echo "ADDED_SUBMODULES=$ADDED_SUBMODULES" >> $GITHUB_ENV
6470
0 commit comments