Skip to content

Scheduled Tasks

Scheduled Tasks #348

Workflow file for this run

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