Nightly Tier Upgrade #47
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Nightly Tier Upgrade | |
| on: | |
| schedule: | |
| # Run at 02:00 UTC every night | |
| - cron: '0 2 * * *' | |
| workflow_dispatch: | |
| inputs: | |
| dry_run: | |
| description: 'Dry run (no DB writes)' | |
| required: false | |
| default: 'false' | |
| jobs: | |
| tier-upgrade: | |
| name: Upgrade creator verification tiers | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Generate Prisma client | |
| run: pnpm exec prisma generate | |
| - name: Run tier upgrade | |
| env: | |
| DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
| DRY_RUN: ${{ github.event.inputs.dry_run || 'false' }} | |
| run: | | |
| pnpm exec tsx lib/cron/tier-upgrade.ts | |
| - name: Notify on failure | |
| if: failure() | |
| env: | |
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
| run: | | |
| if [[ -z "$SLACK_WEBHOOK_URL" ]]; then | |
| echo "⚠️ SLACK_WEBHOOK_URL not set, skipping notification" | |
| exit 0 | |
| fi | |
| curl -fsSL -X POST "$SLACK_WEBHOOK_URL" \ | |
| -H 'Content-Type: application/json' \ | |
| -d '{ | |
| "text": "❌ *Nightly Tier Upgrade Failed*", | |
| "attachments": [{ | |
| "color": "danger", | |
| "fields": [ | |
| {"title": "Workflow", "value": "Nightly Tier Upgrade", "short": true}, | |
| {"title": "Status", "value": "Failed", "short": true}, | |
| {"title": "Run", "value": "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View logs>", "short": false} | |
| ] | |
| }] | |
| }' |