diff --git a/diff-sha.sh b/diff-sha.sh index 7e2c0523..5dcdc39e 100644 --- a/diff-sha.sh +++ b/diff-sha.sh @@ -7,11 +7,16 @@ GITHUB_OUTPUT=${GITHUB_OUTPUT:-""} EXTRA_ARGS="--no-tags" PREVIOUS_SHA="" CURRENT_SHA="" +DIFF="..." if [[ "$GITHUB_REF" == "refs/tags/"* ]]; then EXTRA_ARGS="" fi +if [[ "$GITHUB_EVENT_HEAD_REPO_FORK" == "true" ]]; then + DIFF=".." +fi + echo "::group::changed-files-diff-sha" if [[ -n $INPUT_PATH ]]; then @@ -205,7 +210,7 @@ else PREVIOUS_SHA=$GITHUB_EVENT_PULL_REQUEST_BASE_SHA && exit_status=$? || exit_status=$? fi - if ! git diff --name-only --ignore-submodules=all "$PREVIOUS_SHA"..."$CURRENT_SHA" 1>/dev/null 2>&1; then + if ! git diff --name-only --ignore-submodules=all "$PREVIOUS_SHA$DIFF$CURRENT_SHA" 1>/dev/null 2>&1; then PREVIOUS_SHA=$(git rev-parse origin/"$TARGET_BRANCH" 2>&1) && exit_status=$? || exit_status=$? fi fi