fix: bug with detecting changes in initial commit.
This commit is contained in:
parent
28a044aa26
commit
98989f19ee
13
diff-sha.sh
13
diff-sha.sh
@ -106,7 +106,7 @@ if [[ -z $GITHUB_BASE_REF ]]; then
|
|||||||
else
|
else
|
||||||
PREVIOUS_SHA=""
|
PREVIOUS_SHA=""
|
||||||
|
|
||||||
if [[ "$GITHUB_EVENT_FORCED" == "false" ]]; then
|
if [[ "$GITHUB_EVENT_FORCED" == "false" || -z "$GITHUB_EVENT_FORCED" ]]; then
|
||||||
PREVIOUS_SHA=$GITHUB_EVENT_BEFORE
|
PREVIOUS_SHA=$GITHUB_EVENT_BEFORE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -115,19 +115,20 @@ if [[ -z $GITHUB_BASE_REF ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$PREVIOUS_SHA" == "$CURRENT_SHA" ]]; then
|
if [[ "$PREVIOUS_SHA" == "$CURRENT_SHA" ]]; then
|
||||||
PREVIOUS_SHA=$(git rev-parse "$CURRENT_SHA^1")
|
PREVIOUS_SHA=$(git rev-parse "$CURRENT_SHA^1" 2>/dev/null || true)
|
||||||
|
|
||||||
if [[ "$PREVIOUS_SHA" == "$CURRENT_SHA" ]]; then
|
if [[ -z "$PREVIOUS_SHA" ]]; then
|
||||||
INITIAL_COMMIT="true"
|
INITIAL_COMMIT="true"
|
||||||
echo "::debug::Initial commit detected"
|
PREVIOUS_SHA=$(git rev-parse "$CURRENT_SHA")
|
||||||
|
echo "::warning::Initial commit detected no previous commit found."
|
||||||
fi
|
fi
|
||||||
fi
|
else
|
||||||
|
|
||||||
if [[ -z "$PREVIOUS_SHA" ]]; then
|
if [[ -z "$PREVIOUS_SHA" ]]; then
|
||||||
echo "::error::Unable to locate a previous commit"
|
echo "::error::Unable to locate a previous commit"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
PREVIOUS_SHA=$INPUT_BASE_SHA
|
PREVIOUS_SHA=$INPUT_BASE_SHA
|
||||||
TARGET_BRANCH=$(git name-rev --name-only "$PREVIOUS_SHA" 2>&1) && exit_status=$? || exit_status=$?
|
TARGET_BRANCH=$(git name-rev --name-only "$PREVIOUS_SHA" 2>&1) && exit_status=$? || exit_status=$?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user