Fix CI: Check if workspace is git repo before clone
Some checks failed
BotServer CI/CD / build (push) Failing after 1s

- If /opt/gbo/data/botserver/.git exists, pull instead of clone
- Prevents 'destination already exists' errors from persistent directories

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Rodrigo Rodriguez (Pragmatismo) 2026-04-10 20:55:49 -03:00
parent 9e8f3bc309
commit 74d820fbde

View file

@ -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