Skip to content

Commit

Permalink
Updated to use merge-base
Browse files Browse the repository at this point in the history
  • Loading branch information
jackton1 committed Dec 5, 2022
1 parent f282e19 commit ef8591d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions diff-sha.sh
Expand Up @@ -200,8 +200,12 @@ else
PREVIOUS_SHA=$(git rev-parse origin/"$CURRENT_BRANCH" 2>&1) && exit_status=$? || exit_status=$?
fi
else
PREVIOUS_SHA=$GITHUB_EVENT_PULL_REQUEST_BASE_SHA && exit_status=$? || exit_status=$?

PREVIOUS_SHA=$(git merge-base "$TARGET_BRANCH" "$CURRENT_SHA" 2>&1) && exit_status=$? || exit_status=$?

if [[ -z "$PREVIOUS_SHA" ]]; then
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
PREVIOUS_SHA=$(git rev-parse origin/"$TARGET_BRANCH" 2>&1) && exit_status=$? || exit_status=$?
fi
Expand Down

0 comments on commit ef8591d

Please sign in to comment.