#!/usr/bin/env bash # Daily catalog refresh for arka/public/opencode. # Runs on core at 05:00 Europe/Moscow. set -euo pipefail # this file lives at opencode/scripts/cron-sync.sh → repo root is ../.. REPO="$(cd "$(dirname "$0")/../.." && pwd)" cd "$REPO" export GIT_SSH_COMMAND="${GIT_SSH_COMMAND:-ssh -i /root/.ssh/arka_public_catalog -o IdentitiesOnly=yes -o StrictHostKeyChecking=accept-new}" git fetch origin main git checkout -q main git reset --hard origin/main python3 opencode/scripts/sync-catalog.py if git diff --quiet -- opencode/catalog.json; then printf '%s no catalog change\n' "$(date -u +%Y-%m-%dT%H:%M:%SZ)" exit 0 fi git add opencode/catalog.json git -c user.name='arka-catalog-bot' -c user.email='noreply@arka-ai.ru' \ commit -m "chore(catalog): refresh $(date -u +%Y-%m-%d)" git push origin main printf '%s catalog pushed\n' "$(date -u +%Y-%m-%dT%H:%M:%SZ)"