Files
Bookra/.github/workflows/reminder-dispatch.yml
T
Tomas DvorakandDevin c7172544b8 feat(metrics): new-clients KPI and scheduled reminder dispatch
The dashboard promised a new-clients card the API never produced; the
metric now counts distinct customer emails whose earliest-ever booking
lands in the window, joining the other four KPIs with the same trend
comparison. The card grid rebalances for five items.

Reminder dispatch also had no trigger — the endpoint existed but
nothing called it. A scheduled GitHub Actions workflow now posts to it
every 15 minutes using the job-runner key, so reminders actually fire
once the two secrets are configured.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-18 12:59:44 +02:00

33 lines
1.0 KiB
YAML

name: Reminder Dispatch
on:
schedule:
# Every 15 minutes. GitHub scheduled workflows may run a few minutes late;
# reminder jobs are timestamp-based so lateness only delays, never skips.
- cron: "*/15 * * * *"
workflow_dispatch:
permissions: {}
jobs:
dispatch:
name: Dispatch due reminders
runs-on: ubuntu-latest
steps:
- name: Call dispatch endpoint
env:
API_URL: ${{ secrets.BOOKRA_API_URL }}
JOB_KEY: ${{ secrets.BOOKRA_JOB_RUNNER_KEY }}
run: |
if [ -z "$API_URL" ] || [ -z "$JOB_KEY" ]; then
echo "BOOKRA_API_URL / BOOKRA_JOB_RUNNER_KEY secrets not configured — skipping."
exit 0
fi
status=$(curl -sS -o /tmp/dispatch.json -w "%{http_code}" \
-X POST "$API_URL/v1/internal/jobs/reminders/dispatch" \
-H "Content-Type: application/json" \
-H "X-Bookra-Job-Key: $JOB_KEY" \
-d '{"limit": 100}')
cat /tmp/dispatch.json
test "$status" = "200"