Fix CI
All checks were successful
Build and Push Docker Images / changes (push) Successful in 6s
Build and Push Docker Images / build-backend (push) Successful in 49s
Build and Push Docker Images / build-frontend (push) Has been skipped

This commit is contained in:
2025-02-27 17:46:53 +01:00
parent 7fbe5e56fb
commit 97efa03c88
2 changed files with 24 additions and 16 deletions

View File

@@ -38,29 +38,37 @@ jobs:
echo "Workflow manually triggered - building both"
BACKEND="true"
FRONTEND="true"
elif [[ "${{ github.ref }}" == refs/tags/* ]]; then
elif [ "${{ github.ref }}" = refs/tags/* ]; then
echo "Tag detected - building both"
BACKEND="true"
FRONTEND="true"
else
echo "Checking changed files between main and current commit..."
echo "Checking changed files..."
# Get the base ref for the comparison
BASE_SHA=$(git rev-parse origin/main)
CURRENT_SHA=${{ github.sha }}
# For push events, compare with the parent commit
if [ "${{ github.event_name }}" = "push" ]; then
echo "Push event detected"
# Get the parent commit
PARENT_SHA=$(git rev-parse HEAD^)
CURRENT_SHA=${{ github.sha }}
echo "Comparing $BASE_SHA...$CURRENT_SHA"
echo "Comparing parent ${PARENT_SHA} with current ${CURRENT_SHA}"
# Check backend changes
if git diff --name-only $BASE_SHA $CURRENT_SHA | grep -q "^backend/"; then
echo "Backend changes detected"
BACKEND="true"
fi
# List all changed files
CHANGED_FILES=$(git diff --name-only ${PARENT_SHA} ${CURRENT_SHA})
echo "Changed files:"
echo "$CHANGED_FILES"
# Check frontend changes
if git diff --name-only $BASE_SHA $CURRENT_SHA | grep -q "^frontend/"; then
echo "Frontend changes detected"
FRONTEND="true"
# Check for changes in specific directories
if echo "$CHANGED_FILES" | grep -q "^backend/"; then
echo "Backend changes detected"
BACKEND="true"
fi
if echo "$CHANGED_FILES" | grep -q "^frontend/"; then
echo "Frontend changes detected"
FRONTEND="true"
fi
fi
fi

View File

@@ -8,7 +8,7 @@ import logging
logger = logging.getLogger(__name__)
logger.info(f"Starting app!!!")
logger.info(f"Starting app!")
app = FastAPI(
title=settings.PROJECT_NAME,
version=settings.VERSION,