35313b16d7
Deploy to route.crispygoat.com / deploy (push) Successful in 4m20s
- New .gitea/workflows/smartsheet-cron.yml: hits POST /api/water-log/smartsheet-sync every 15min with SMARTSHEET_CRON_SECRET bearer. Replaces the no-op vercel.json cron entry (ignored on self-hosted Gitea). - deploy.yml now writes SMARTSHEET_TOKEN_ENC_KEY and SMARTSHEET_CRON_SECRET to the runtime .env on every deploy so we don't silently lose them. - Dropped the unused cron entry from vercel.json.
41 lines
1.5 KiB
YAML
41 lines
1.5 KiB
YAML
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"
|