diff --git a/.forgejo/workflows/botserver.yaml b/.forgejo/workflows/botserver.yaml index c1848007..fb6bf522 100644 --- a/.forgejo/workflows/botserver.yaml +++ b/.forgejo/workflows/botserver.yaml @@ -28,14 +28,22 @@ jobs: run: | mkdir -p $WORKSPACE cd $WORKSPACE - # Clean existing .git to avoid conflicts - rm -rf /opt/gbo/data/botserver/.git 2>/dev/null || true # Update or clone botserver (preserve git history for sccache fingerprints) if [ -d botserver/.git ]; then git -C botserver pull origin main else git clone --branch main https://alm.pragmatismo.com.br/GeneralBots/BotServer.git botserver fi + # Clean existing .git to avoid conflicts + rm -rf /opt/gbo/data/botserver/.git 2>/dev/null || true + # Check if workspace is valid git repo before cloning + if [ -d /opt/gbo/data/botserver/.git ]; then + echo "Workspace is valid git repo, using pull" + git -C /opt/gbo/data/botserver pull origin main || true + else + echo "Workspace is not a git repo, cloning fresh" + git clone --branch main https://alm.pragmatismo.com.br/GeneralBots/BotServer.git /opt/gbo/data/botserver + fi # Get workspace Cargo.toml from gb and strip unused members if [ -d /opt/gbo/data/botserver/.git ]; then git -C /opt/gbo/data/botserver pull origin main