diff --git a/.gitea/workflows/docker-build.yml b/.gitea/workflows/docker-build.yml index 32a2a48..90bb9c1 100644 --- a/.gitea/workflows/docker-build.yml +++ b/.gitea/workflows/docker-build.yml @@ -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 diff --git a/backend/app/main.py b/backend/app/main.py index 755f7cb..7686473 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -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,