Cron: EDRSR Sync from data.gov.ua #66
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
| ############################################################################## | |
| # EDRSR Daily Sync: data.gov.ua → prod PostgreSQL | |
| # - Downloads current year ZIP from data.gov.ua (blocked from AWS, accessible from local runner) | |
| # - Imports new records incrementally (ON CONFLICT DO NOTHING) | |
| # - Runs daily at 4:00 AM Kyiv time (1:00 AM UTC) | |
| # - Can also be triggered manually with year parameter | |
| ############################################################################## | |
| name: 'Cron: EDRSR Sync from data.gov.ua' | |
| on: | |
| schedule: | |
| # 01:00 UTC = 04:00 Kyiv (EET+3 summer / EET+2 winter) | |
| - cron: '0 1 * * *' | |
| workflow_dispatch: | |
| inputs: | |
| year: | |
| description: 'Year to sync (default: current year)' | |
| required: false | |
| type: string | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: edrsr-sync | |
| cancel-in-progress: false | |
| jobs: | |
| sync-edrsr: | |
| name: Sync EDRSR ${{ inputs.year || 'current year' }} | |
| runs-on: [self-hosted, local] | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Run incremental sync | |
| env: | |
| SSH_HOST: prod | |
| run: | | |
| YEAR="${{ inputs.year || '' }}" | |
| if [ -n "$YEAR" ]; then | |
| ./scripts/edrsr/sync-edrsr-incremental.sh "$YEAR" | |
| else | |
| ./scripts/edrsr/sync-edrsr-incremental.sh | |
| fi | |
| - name: Check sync result | |
| if: always() | |
| run: | | |
| YEAR="${{ inputs.year }}" | |
| [ -z "$YEAR" ] && YEAR="$(date +%Y)" | |
| if [ -f "/tmp/edrsr_sync_${YEAR}.log" ]; then | |
| echo "=== Sync Log ===" | |
| cat "/tmp/edrsr_sync_${YEAR}.log" | |
| fi |