3
0
Fork 0
mirror of https://github.com/tj-actions/changed-files synced 2025-03-05 21:06:25 +00:00

feat: pull submodule history for pull request events (#1003)

This commit is contained in:
Tonye Jack 2023-02-28 12:47:37 -07:00 committed by GitHub
parent 6f22f2f9ba
commit 04124efe75
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 3 deletions

View file

@ -342,12 +342,15 @@ jobs:
max-parallel: 4 max-parallel: 4
matrix: matrix:
platform: [ubuntu-latest] platform: [ubuntu-latest]
fetch-depth: [0, 1]
steps: steps:
- name: Checkout to branch - name: Checkout to branch
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
submodules: recursive submodules: recursive
fetch-depth: ${{ matrix.fetch-depth }}
- name: Run changed-files with submodule - name: Run changed-files with submodule
id: changed-files id: changed-files

View file

@ -75,8 +75,11 @@ if [[ -z $GITHUB_EVENT_PULL_REQUEST_BASE_REF ]]; then
# shellcheck disable=SC2086 # shellcheck disable=SC2086
git fetch $EXTRA_ARGS -u --progress --deepen="$INPUT_FETCH_DEPTH" origin +refs/heads/"$SOURCE_BRANCH":refs/remotes/origin/"$SOURCE_BRANCH" 1>/dev/null git fetch $EXTRA_ARGS -u --progress --deepen="$INPUT_FETCH_DEPTH" origin +refs/heads/"$SOURCE_BRANCH":refs/remotes/origin/"$SOURCE_BRANCH" 1>/dev/null
fi fi
# shellcheck disable=SC2086
git submodule foreach git fetch $EXTRA_ARGS -u --progress --deepen="$INPUT_FETCH_DEPTH" || true if git submodule status &>/dev/null; then
# shellcheck disable=SC2086
git submodule foreach git fetch $EXTRA_ARGS -u --progress --deepen="$INPUT_FETCH_DEPTH" || true
fi
fi fi
echo "::debug::Getting HEAD SHA..." echo "::debug::Getting HEAD SHA..."
@ -194,6 +197,11 @@ else
git fetch $EXTRA_ARGS -u --progress --deepen="$INPUT_FETCH_DEPTH" origin +refs/heads/"$TARGET_BRANCH":refs/remotes/origin/"$TARGET_BRANCH" 1>/dev/null git fetch $EXTRA_ARGS -u --progress --deepen="$INPUT_FETCH_DEPTH" origin +refs/heads/"$TARGET_BRANCH":refs/remotes/origin/"$TARGET_BRANCH" 1>/dev/null
git branch --track "$TARGET_BRANCH" origin/"$TARGET_BRANCH" 1>/dev/null || true git branch --track "$TARGET_BRANCH" origin/"$TARGET_BRANCH" 1>/dev/null || true
fi fi
if git submodule status &>/dev/null; then
# shellcheck disable=SC2086
git submodule foreach git fetch $EXTRA_ARGS -u --progress --deepen="$INPUT_FETCH_DEPTH" || true
fi
fi fi
echo "::debug::Getting HEAD SHA..." echo "::debug::Getting HEAD SHA..."

View file

@ -93,7 +93,6 @@ function get_diff() {
fi fi
done < <(git submodule status --recursive | grep -v "^-" | awk '{print $2}') done < <(git submodule status --recursive | grep -v "^-" | awk '{print $2}')
if [[ "$filter" == "D" ]]; then if [[ "$filter" == "D" ]]; then
while read -r sub; do while read -r sub; do
echo "$sub" echo "$sub"