3
0
Fork 0
mirror of https://github.com/tj-actions/changed-files synced 2024-12-17 03:47:20 +00:00

fix: fetching history for pr made from a fork with checkout set to the target repository (#1007)

This commit is contained in:
Tonye Jack 2023-03-08 20:02:52 -07:00 committed by GitHub
parent 89c8821949
commit 5ce975c602
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -188,8 +188,14 @@ else
if [[ "$IS_SHALLOW" == "true" ]]; then
echo "Fetching remote refs..."
# shellcheck disable=SC2086
git fetch $EXTRA_ARGS -u --progress origin pull/"$GITHUB_EVENT_PULL_REQUEST_NUMBER"/head:"$CURRENT_BRANCH" 1>/dev/null
if [[ "$GITHUB_EVENT_HEAD_REPO_FORK" != "true" ]]; then
# shellcheck disable=SC2086
git fetch $EXTRA_ARGS -u --progress origin pull/"$GITHUB_EVENT_PULL_REQUEST_NUMBER"/head:"$CURRENT_BRANCH" 1>/dev/null
else
# shellcheck disable=SC2086
git fetch $EXTRA_ARGS -u --progress origin "+refs/heads/$TARGET_BRANCH:refs/remotes/origin/$TARGET_BRANCH" "+refs/heads/$CURRENT_BRANCH*:refs/remotes/origin/$CURRENT_BRANCH*" 1>/dev/null
fi
if [[ "$INPUT_SINCE_LAST_REMOTE_COMMIT" != "true" ]]; then
echo "::debug::Fetching remote target branch..."