Scheduled Tweets #2447
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: Scheduled Tweets | |
| on: | |
| schedule: | |
| # 3 windows/day; cron runs every 15 min in each window; server posts once at a random slot per window (UTC) | |
| # Morning 12:00-13:45 | |
| - cron: '0 12 * * *' | |
| - cron: '15 12 * * *' | |
| - cron: '30 12 * * *' | |
| - cron: '45 12 * * *' | |
| - cron: '0 13 * * *' | |
| - cron: '15 13 * * *' | |
| - cron: '30 13 * * *' | |
| - cron: '45 13 * * *' | |
| # Afternoon 17:00-18:45 | |
| - cron: '0 17 * * *' | |
| - cron: '15 17 * * *' | |
| - cron: '30 17 * * *' | |
| - cron: '45 17 * * *' | |
| - cron: '0 18 * * *' | |
| - cron: '15 18 * * *' | |
| - cron: '30 18 * * *' | |
| - cron: '45 18 * * *' | |
| # Evening 22:00-23:45 | |
| - cron: '0 22 * * *' | |
| - cron: '15 22 * * *' | |
| - cron: '30 22 * * *' | |
| - cron: '45 22 * * *' | |
| - cron: '0 23 * * *' | |
| - cron: '15 23 * * *' | |
| - cron: '30 23 * * *' | |
| - cron: '45 23 * * *' | |
| workflow_dispatch: {} | |
| jobs: | |
| tweet: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Post scheduled tweet | |
| env: | |
| SUPABASE_FUNCTION_URL: ${{ secrets.SUPABASE_FUNCTION_URL }} | |
| SUPABASE_ANON_KEY: ${{ secrets.SUPABASE_ANON_KEY }} | |
| TWITTER_WEBHOOK_SECRET: ${{ secrets.TWITTER_WEBHOOK_SECRET }} | |
| run: | | |
| FORCE=false | |
| if [ "${GITHUB_EVENT_NAME}" = "workflow_dispatch" ]; then FORCE=true; fi | |
| curl -sf -X POST "${SUPABASE_FUNCTION_URL}/twitter/scheduled" \ | |
| -H "Content-Type: application/json" \ | |
| -H "Authorization: Bearer ${SUPABASE_ANON_KEY}" \ | |
| -d "{\"secret\":\"${TWITTER_WEBHOOK_SECRET}\",\"force\":${FORCE}}" \ | |
| || echo "Scheduled tweet failed (non-fatal)" |