This commit is contained in:
parent
549fc97b54
commit
05c190bb9b
@ -74,20 +74,20 @@ if [ "$MODE" = "post-deploy" ]; then
|
|||||||
if command -v git >/dev/null 2>&1 && [ -d .git ]; then
|
if command -v git >/dev/null 2>&1 && [ -d .git ]; then
|
||||||
# Try multiple methods to detect changed files (Woodpecker might do shallow clone)
|
# Try multiple methods to detect changed files (Woodpecker might do shallow clone)
|
||||||
|
|
||||||
# Method 1: Use git diff to see actual file changes (most accurate)
|
# Method 1: Use Woodpecker CI environment variables (most reliable in CI)
|
||||||
CHANGED_FILE_PATHS=$(git diff --name-only HEAD~1 HEAD -- files/ 2>/dev/null || echo "")
|
if [ -n "${CI_PREV_COMMIT_SHA:-}" ] && [ -n "${CI_COMMIT_SHA:-}" ]; then
|
||||||
|
echo " DEBUG: Using Woodpecker commit range: ${CI_PREV_COMMIT_SHA}..${CI_COMMIT_SHA}"
|
||||||
# Method 2: If method 1 fails (no parent commit), use git show
|
CHANGED_FILE_PATHS=$(git diff --name-only "${CI_PREV_COMMIT_SHA}" "${CI_COMMIT_SHA}" -- files/ 2>/dev/null || echo "")
|
||||||
if [ -z "$CHANGED_FILE_PATHS" ]; then
|
# Method 2: Use git diff with HEAD~1
|
||||||
|
elif git rev-parse HEAD~1 >/dev/null 2>&1; then
|
||||||
|
echo " DEBUG: Using git diff HEAD~1..HEAD"
|
||||||
|
CHANGED_FILE_PATHS=$(git diff --name-only HEAD~1 HEAD -- files/ 2>/dev/null || echo "")
|
||||||
|
# Method 3: Use git show (less accurate - shows all files in commit)
|
||||||
|
else
|
||||||
|
echo " DEBUG: Using git show HEAD (may show all files in commit)"
|
||||||
CHANGED_FILE_PATHS=$(git show --name-only --pretty="" HEAD -- files/ 2>/dev/null || echo "")
|
CHANGED_FILE_PATHS=$(git show --name-only --pretty="" HEAD -- files/ 2>/dev/null || echo "")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Method 3: If still nothing, check Woodpecker CI environment variables
|
|
||||||
if [ -z "$CHANGED_FILE_PATHS" ] && [ -n "${CI_COMMIT_CHANGED_FILES:-}" ]; then
|
|
||||||
# Filter CI_COMMIT_CHANGED_FILES to only files/ directory
|
|
||||||
CHANGED_FILE_PATHS=$(echo "$CI_COMMIT_CHANGED_FILES" | tr ' ' '\n' | grep '^files/' || echo "")
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo " DEBUG: Git detection method results: '$CHANGED_FILE_PATHS'"
|
echo " DEBUG: Git detection method results: '$CHANGED_FILE_PATHS'"
|
||||||
|
|
||||||
if [ -n "$CHANGED_FILE_PATHS" ]; then
|
if [ -n "$CHANGED_FILE_PATHS" ]; then
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user