mirror of
https://github.com/tj-actions/changed-files
synced 2025-02-06 09:41:22 +00:00
fix: bug with fetching history (#989)
This commit is contained in:
parent
bda7fb2353
commit
ca6650c514
1 changed files with 4 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
set -euo pipefail
|
set -euxo pipefail
|
||||||
|
|
||||||
INITIAL_COMMIT="false"
|
INITIAL_COMMIT="false"
|
||||||
GITHUB_OUTPUT=${GITHUB_OUTPUT:-""}
|
GITHUB_OUTPUT=${GITHUB_OUTPUT:-""}
|
||||||
|
@ -57,7 +57,7 @@ if [[ -z $GITHUB_EVENT_PULL_REQUEST_BASE_REF ]]; then
|
||||||
TARGET_BRANCH=$GITHUB_REFNAME
|
TARGET_BRANCH=$GITHUB_REFNAME
|
||||||
CURRENT_BRANCH=$TARGET_BRANCH
|
CURRENT_BRANCH=$TARGET_BRANCH
|
||||||
|
|
||||||
if [[ -f .git/shallow ]]; then
|
if $(git rev-parse --is-shallow-repository); then
|
||||||
echo "Fetching remote refs..."
|
echo "Fetching remote refs..."
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
git fetch $EXTRA_ARGS -u --progress --deepen="$INPUT_FETCH_DEPTH" origin +refs/heads/"$CURRENT_BRANCH":refs/remotes/origin/"$CURRENT_BRANCH" 1>/dev/null
|
git fetch $EXTRA_ARGS -u --progress --deepen="$INPUT_FETCH_DEPTH" origin +refs/heads/"$CURRENT_BRANCH":refs/remotes/origin/"$CURRENT_BRANCH" 1>/dev/null
|
||||||
|
@ -162,7 +162,7 @@ else
|
||||||
TARGET_BRANCH=$CURRENT_BRANCH
|
TARGET_BRANCH=$CURRENT_BRANCH
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -f .git/shallow ]]; then
|
if $(git rev-parse --is-shallow-repository); then
|
||||||
echo "Fetching remote refs..."
|
echo "Fetching remote refs..."
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
git fetch $EXTRA_ARGS -u --progress origin pull/"$GITHUB_EVENT_PULL_REQUEST_NUMBER"/head:"$CURRENT_BRANCH" 1>/dev/null
|
git fetch $EXTRA_ARGS -u --progress origin pull/"$GITHUB_EVENT_PULL_REQUEST_NUMBER"/head:"$CURRENT_BRANCH" 1>/dev/null
|
||||||
|
@ -213,7 +213,7 @@ else
|
||||||
else
|
else
|
||||||
PREVIOUS_SHA=$(git rev-parse origin/"$TARGET_BRANCH") && exit_status=$? || exit_status=$?
|
PREVIOUS_SHA=$(git rev-parse origin/"$TARGET_BRANCH") && exit_status=$? || exit_status=$?
|
||||||
|
|
||||||
if [[ -f .git/shallow ]]; then
|
if $(git rev-parse --is-shallow-repository); then
|
||||||
# check if the merge base is in the local history
|
# check if the merge base is in the local history
|
||||||
if ! git merge-base "$PREVIOUS_SHA" "$CURRENT_SHA" 1>/dev/null 2>&1; then
|
if ! git merge-base "$PREVIOUS_SHA" "$CURRENT_SHA" 1>/dev/null 2>&1; then
|
||||||
echo "::debug::Merge base is not in the local history, fetching remote target branch..."
|
echo "::debug::Merge base is not in the local history, fetching remote target branch..."
|
||||||
|
|
Loading…
Add table
Reference in a new issue