Skip to content

Sync Paystack Plans #43

Sync Paystack Plans

Sync Paystack Plans #43

Workflow file for this run

name: Sync Paystack Plans
on:
schedule:
- cron: '0 0 * * *' # Runs daily at midnight
workflow_dispatch: # Allows manual triggering
push:
branches:
- main
paths:
- 'scripts/sync-plans.ts'
jobs:
sync-plans:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'
- name: Setup PNPM
uses: pnpm/action-setup@v2
with:
version: 8
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v3
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- name: Create .env file
run: |
echo "NEXT_PUBLIC_SUPABASE_URL=${{ secrets.NEXT_PUBLIC_SUPABASE_URL }}" >> .env
echo "SUPABASE_SERVICE_ROLE_KEY=${{ secrets.SUPABASE_SERVICE_ROLE_KEY }}" >> .env
echo "PAYSTACK_SECRET_KEY=${{ secrets.PAYSTACK_SECRET_KEY }}" >> .env
echo "NEXT_PUBLIC_PAYSTACK_PUBLIC_KEY=${{ secrets.NEXT_PUBLIC_PAYSTACK_PUBLIC_KEY }}" >> .env
- name: Verify environment variables
run: |
if [ -z "${{ secrets.NEXT_PUBLIC_SUPABASE_URL }}" ]; then
echo "Error: NEXT_PUBLIC_SUPABASE_URL is not set"
exit 1
fi
if [ -z "${{ secrets.SUPABASE_SERVICE_ROLE_KEY }}" ]; then
echo "Error: SUPABASE_SERVICE_ROLE_KEY is not set"
exit 1
fi
if [ -z "${{ secrets.PAYSTACK_SECRET_KEY }}" ]; then
echo "Error: PAYSTACK_SECRET_KEY is not set"
exit 1
fi
- name: Sync Paystack plans
run: pnpm paystack:sync-plans