Scheduled Tasks #348
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 Tasks | |
| on: | |
| schedule: | |
| - cron: '0 0 1 * *' # Midnight on 1st | |
| - cron: '0 0 * * *' # Daily midnight | |
| workflow_dispatch: | |
| inputs: | |
| job_to_run: | |
| description: 'Which job to run' | |
| required: true | |
| type: choice | |
| options: | |
| - reset-tokens | |
| - deploy-latest-server-version | |
| - both | |
| jobs: | |
| reset-tokens: | |
| runs-on: ubuntu-latest | |
| if: > | |
| github.event_name == 'workflow_dispatch' && | |
| ( | |
| github.event.inputs.job_to_run == 'reset-tokens' || | |
| github.event.inputs.job_to_run == 'both' | |
| ) | |
| steps: | |
| - name: Reset Tokens | |
| run: | | |
| curl -X GET \ | |
| -H "Authorization: Bearer ${{ secrets.CRON_SECRET }}" \ | |
| ${{ secrets.VERCEL_URL }}/api/cron/reset-tokens | |
| reset-tokens-monthly: | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'schedule' && github.event.schedule == '0 0 1 * *' | |
| steps: | |
| - name: Reset Tokens | |
| run: | | |
| curl -X GET \ | |
| -H "Authorization: Bearer ${{ secrets.CRON_SECRET }}" \ | |
| ${{ secrets.VERCEL_URL }}/api/cron/reset-tokens | |
| deploy-latest-server-version: | |
| runs-on: ubuntu-latest | |
| if: > | |
| github.event_name == 'workflow_dispatch' && | |
| ( | |
| github.event.inputs.job_to_run == 'deploy-latest-server-version' || | |
| github.event.inputs.job_to_run == 'both' | |
| ) | |
| steps: | |
| - name: Deploy latest server version | |
| run: | | |
| curl -X GET \ | |
| -H "Authorization: Bearer ${{ secrets.CRON_SECRET }}" \ | |
| ${{ secrets.VERCEL_URL }}/api/cron/redeploy | |
| deploy-latest-server-version-daily: | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'schedule' && github.event.schedule == '0 0 * * *' | |
| steps: | |
| - name: Deploy latest server version | |
| run: | | |
| curl -X GET \ | |
| -H "Authorization: Bearer ${{ secrets.CRON_SECRET }}" \ | |
| ${{ secrets.VERCEL_URL }}/api/cron/redeploy |