#!/bin/bash
# Git pull triggered by Gitea webhook

LOG_FILE="/tmp/git-pull.log"
{
  echo "$(date '+%Y-%m-%d %H:%M:%S') - Git pull started"
  cd /data/app/igny8 || exit 0
  git config --global --add safe.directory /data/app/igny8 2>/dev/null || true
  git config --global --add safe.directory /data/app/igny8/backend 2>/dev/null || true
  git config --global --add safe.directory /data/app/igny8/frontend 2>/dev/null || true
  git pull origin main
  echo "$(date '+%Y-%m-%d %H:%M:%S') - Git pull completed"
} >> "$LOG_FILE" 2>&1
