- payple-renew: 만료 구독 조회 → paypleBilling → 기간 갱신 - 3회 연속 실패 시 tier=free, status=expired 다운그레이드 - migration: subscriptions.renewal_failures 컬럼 추가 - payple-webhook: 결제 완료 시 renewal_failures=0 리셋 - GitHub Actions: 매일 01:00 UTC 스케줄
29 lines
830 B
YAML
29 lines
830 B
YAML
name: Payple Subscription Renewal
|
|
|
|
on:
|
|
schedule:
|
|
# 매일 01:00 UTC (KST 10:00)
|
|
- cron: '0 1 * * *'
|
|
workflow_dispatch: {}
|
|
|
|
jobs:
|
|
renew:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Trigger payple-renew Edge Function
|
|
run: |
|
|
response=$(curl -s -w "\n%{http_code}" -X POST \
|
|
"${{ secrets.SUPABASE_URL }}/functions/v1/payple-renew" \
|
|
-H "Authorization: Bearer ${{ secrets.CRON_SECRET }}" \
|
|
-H "Content-Type: application/json")
|
|
|
|
http_code=$(echo "$response" | tail -1)
|
|
body=$(echo "$response" | head -n -1)
|
|
|
|
echo "HTTP $http_code"
|
|
echo "$body" | jq . 2>/dev/null || echo "$body"
|
|
|
|
if [ "$http_code" -ge 400 ]; then
|
|
echo "::error::Renewal failed with HTTP $http_code"
|
|
exit 1
|
|
fi
|