name: Smartsheet sync cron # Replaces the `vercel.json` cron entry (ignored on self-hosted Gitea). # Drains the Smartsheet sync queue every 15 minutes via the running # Next.js app's POST /api/water-log/smartsheet-sync endpoint. on: schedule: # Every 15 minutes. Gitea Actions uses standard 5-field cron syntax; # `0,15,30,45 * * * *` is the explicit form to avoid `*/15` # parser quirks across older Gitea versions. - cron: "0,15,30,45 * * * *" workflow_dispatch: jobs: drain-sync-queue: runs-on: ubuntu-latest steps: - name: Hit /api/water-log/smartsheet-sync env: SMARTSHEET_CRON_SECRET: ${{ secrets.SMARTSHEET_CRON_SECRET }} SITE_URL: ${{ secrets.NEXT_PUBLIC_SITE_URL }} run: | set -euo pipefail if [ -z "$SMARTSHEET_CRON_SECRET" ]; then echo "SMARTSHEET_CRON_SECRET secret not set — skipping." exit 0 fi if [ -z "$SITE_URL" ]; then echo "NEXT_PUBLIC_SITE_URL secret not set — skipping." exit 0 fi echo "POST $SITE_URL/api/water-log/smartsheet-sync" curl -fsS --max-time 60 -X POST \ -H "Authorization: Bearer $SMARTSHEET_CRON_SECRET" \ -H "Content-Type: application/json" \ -H "User-Agent: gitea-smartsheet-cron/1" \ "${SITE_URL%/}/api/water-log/smartsheet-sync" \ --data '{}' \ -w "\n[http %{http_code} in %{time_total}s]\n"