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

Fixed bug retrieving the first commit of a pull request

This commit is contained in:
Tonye Jack 2022-10-30 21:08:40 -06:00
parent 983dfd764c
commit 1e6b143073

View file

@ -111,7 +111,7 @@ if [[ -z $GITHUB_BASE_REF ]]; then
fi fi
if [[ -z "$PREVIOUS_SHA" || "$PREVIOUS_SHA" == "0000000000000000000000000000000000000000" ]]; then if [[ -z "$PREVIOUS_SHA" || "$PREVIOUS_SHA" == "0000000000000000000000000000000000000000" ]]; then
PREVIOUS_SHA=$(git rev-parse "$(git branch -r --sort=-committerdate | head -1 | xargs)") PREVIOUS_SHA=$CURRENT_SHA
fi fi
if [[ "$PREVIOUS_SHA" == "$CURRENT_SHA" ]]; then if [[ "$PREVIOUS_SHA" == "$CURRENT_SHA" ]]; then
@ -119,6 +119,8 @@ if [[ -z $GITHUB_BASE_REF ]]; then
INITIAL_COMMIT="true" INITIAL_COMMIT="true"
PREVIOUS_SHA=$(git rev-parse "$CURRENT_SHA") PREVIOUS_SHA=$(git rev-parse "$CURRENT_SHA")
echo "::warning::Initial commit detected no previous commit found." echo "::warning::Initial commit detected no previous commit found."
else
PREVIOUS_SHA=$(git rev-parse "$PREVIOUS_SHA^1")
fi fi
else else
if [[ -z "$PREVIOUS_SHA" ]]; then if [[ -z "$PREVIOUS_SHA" ]]; then