mirror of
https://github.com/tj-actions/changed-files
synced 2025-02-22 11:17:38 +00:00
Merge pull request #729 from tj-actions/chore/update-debug-message
This commit is contained in:
commit
e793a5d902
1 changed files with 6 additions and 4 deletions
10
diff-sha.sh
10
diff-sha.sh
|
@ -18,12 +18,12 @@ if [[ -n $INPUT_PATH ]]; then
|
||||||
cd "$REPO_DIR"
|
cd "$REPO_DIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Verifying git version..."
|
|
||||||
|
|
||||||
function __version() {
|
function __version() {
|
||||||
echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }';
|
echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echo "Verifying git version..."
|
||||||
|
|
||||||
GIT_VERSION=$(git --version | awk '{print $3}') && exit_status=$? || exit_status=$?
|
GIT_VERSION=$(git --version | awk '{print $3}') && exit_status=$? || exit_status=$?
|
||||||
|
|
||||||
if [[ $exit_status -ne 0 ]]; then
|
if [[ $exit_status -ne 0 ]]; then
|
||||||
|
@ -32,7 +32,7 @@ if [[ $exit_status -ne 0 ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $(__version "$GIT_VERSION") -lt $(__version "2.18.0") ]]; then
|
if [[ $(__version "$GIT_VERSION") -lt $(__version "2.18.0") ]]; then
|
||||||
echo "::error::Invalid git version. Please upgrade git ($GIT_VERSION) to >= (2.18.0)"
|
echo "::error::Invalid git version. Please upgrade ($GIT_VERSION) to >= (2.18.0)"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo "Valid git version found: ($GIT_VERSION)"
|
echo "Valid git version found: ($GIT_VERSION)"
|
||||||
|
@ -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
|
||||||
|
|
Loading…
Add table
Reference in a new issue