Skip to content

Commit 04124ef

Browse files
authored
feat: pull submodule history for pull request events (#1003)
1 parent 6f22f2f commit 04124ef

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,12 +342,15 @@ jobs:
342342
max-parallel: 4
343343
matrix:
344344
platform: [ubuntu-latest]
345+
fetch-depth: [0, 1]
345346

346347
steps:
347348
- name: Checkout to branch
348349
uses: actions/checkout@v3
349350
with:
351+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
350352
submodules: recursive
353+
fetch-depth: ${{ matrix.fetch-depth }}
351354

352355
- name: Run changed-files with submodule
353356
id: changed-files

diff-sha.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,11 @@ if [[ -z $GITHUB_EVENT_PULL_REQUEST_BASE_REF ]]; then
7575
# shellcheck disable=SC2086
7676
git fetch $EXTRA_ARGS -u --progress --deepen="$INPUT_FETCH_DEPTH" origin +refs/heads/"$SOURCE_BRANCH":refs/remotes/origin/"$SOURCE_BRANCH" 1>/dev/null
7777
fi
78-
# shellcheck disable=SC2086
79-
git submodule foreach git fetch $EXTRA_ARGS -u --progress --deepen="$INPUT_FETCH_DEPTH" || true
78+
79+
if git submodule status &>/dev/null; then
80+
# shellcheck disable=SC2086
81+
git submodule foreach git fetch $EXTRA_ARGS -u --progress --deepen="$INPUT_FETCH_DEPTH" || true
82+
fi
8083
fi
8184

8285
echo "::debug::Getting HEAD SHA..."
@@ -194,6 +197,11 @@ else
194197
git fetch $EXTRA_ARGS -u --progress --deepen="$INPUT_FETCH_DEPTH" origin +refs/heads/"$TARGET_BRANCH":refs/remotes/origin/"$TARGET_BRANCH" 1>/dev/null
195198
git branch --track "$TARGET_BRANCH" origin/"$TARGET_BRANCH" 1>/dev/null || true
196199
fi
200+
201+
if git submodule status &>/dev/null; then
202+
# shellcheck disable=SC2086
203+
git submodule foreach git fetch $EXTRA_ARGS -u --progress --deepen="$INPUT_FETCH_DEPTH" || true
204+
fi
197205
fi
198206

199207
echo "::debug::Getting HEAD SHA..."

get-changed-paths.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ function get_diff() {
9393
fi
9494
done < <(git submodule status --recursive | grep -v "^-" | awk '{print $2}')
9595

96-
9796
if [[ "$filter" == "D" ]]; then
9897
while read -r sub; do
9998
echo "$sub"

0 commit comments

Comments
 (0)