Skip to content

Commit

Permalink
feat: pull submodule history for pull request events (#1003)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackton1 authored Feb 28, 2023
1 parent 6f22f2f commit 04124ef
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -342,12 +342,15 @@ jobs:
max-parallel: 4
matrix:
platform: [ubuntu-latest]
fetch-depth: [0, 1]

steps:
- name: Checkout to branch
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
submodules: recursive
fetch-depth: ${{ matrix.fetch-depth }}

- name: Run changed-files with submodule
id: changed-files
Expand Down
12 changes: 10 additions & 2 deletions diff-sha.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,11 @@ if [[ -z $GITHUB_EVENT_PULL_REQUEST_BASE_REF ]]; then
# 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
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

echo "::debug::Getting HEAD SHA..."
Expand Down Expand Up @@ -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 branch --track "$TARGET_BRANCH" origin/"$TARGET_BRANCH" 1>/dev/null || true
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

echo "::debug::Getting HEAD SHA..."
Expand Down
1 change: 0 additions & 1 deletion get-changed-paths.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ function get_diff() {
fi
done < <(git submodule status --recursive | grep -v "^-" | awk '{print $2}')


if [[ "$filter" == "D" ]]; then
while read -r sub; do
echo "$sub"
Expand Down

0 comments on commit 04124ef

Please sign in to comment.