Lexware Scheduled Jobs #50
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: Lexware Scheduled Jobs | |
| on: | |
| schedule: | |
| # Sync: daily at 03:00 UTC. Route decides delta vs full based on UTC day. | |
| - cron: "0 3 * * *" | |
| # Webhook retry: every 15 minutes. | |
| - cron: "*/15 * * * *" | |
| # Webhook retention: daily at 04:00 UTC (after sync, so retention never races a running sync). | |
| - cron: "0 4 * * *" | |
| workflow_dispatch: | |
| inputs: | |
| job: | |
| description: "Which cron job to run manually" | |
| required: true | |
| default: "sync" | |
| type: choice | |
| options: | |
| - sync | |
| - webhook-retry | |
| - webhook-retention | |
| concurrency: | |
| group: lexware-cron-${{ github.event.schedule || github.event.inputs.job }} | |
| cancel-in-progress: false | |
| jobs: | |
| sync: | |
| if: github.event.schedule == '0 3 * * *' || github.event.inputs.job == 'sync' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Trigger lexware-sync | |
| env: | |
| APP_URL: ${{ secrets.APP_URL }} | |
| CRON_SECRET: ${{ secrets.CRON_SECRET }} | |
| run: | | |
| curl -fsS -X POST \ | |
| -H "Authorization: Bearer $CRON_SECRET" \ | |
| -H "Content-Type: application/json" \ | |
| --max-time 1500 \ | |
| "$APP_URL/api/cron/lexware-sync" | |
| webhook-retry: | |
| if: github.event.schedule == '*/15 * * * *' || github.event.inputs.job == 'webhook-retry' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Trigger lexware-webhook-retry | |
| env: | |
| APP_URL: ${{ secrets.APP_URL }} | |
| CRON_SECRET: ${{ secrets.CRON_SECRET }} | |
| run: | | |
| curl -fsS -X POST \ | |
| -H "Authorization: Bearer $CRON_SECRET" \ | |
| -H "Content-Type: application/json" \ | |
| --max-time 240 \ | |
| "$APP_URL/api/cron/lexware-webhook-retry" | |
| webhook-retention: | |
| if: github.event.schedule == '0 4 * * *' || github.event.inputs.job == 'webhook-retention' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Trigger lexware-webhook-retention | |
| env: | |
| APP_URL: ${{ secrets.APP_URL }} | |
| CRON_SECRET: ${{ secrets.CRON_SECRET }} | |
| run: | | |
| curl -fsS -X POST \ | |
| -H "Authorization: Bearer $CRON_SECRET" \ | |
| -H "Content-Type: application/json" \ | |
| --max-time 240 \ | |
| "$APP_URL/api/cron/lexware-webhook-retention" |