Repository navigation
Admin data export #55
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: Admin data export | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| # Render free Postgres expires on 2026-06-13. Keep this daily backup active | |
| # until the database is upgraded or moved to a durable plan. | |
| - cron: "17 2 * * *" | |
| permissions: | |
| contents: read | |
| jobs: | |
| export: | |
| name: Export protected admin data | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Export backend admin data | |
| env: | |
| FK_BACKEND_ADMIN_TOKEN: ${{ secrets.FK_BACKEND_ADMIN_TOKEN }} | |
| FK_BACKEND_EXPORT_URL: ${{ vars.FK_BACKEND_EXPORT_URL || 'https://fkdev-admin-api.onrender.com/admin/export' }} | |
| run: | | |
| set -euo pipefail | |
| if [ -z "${FK_BACKEND_ADMIN_TOKEN:-}" ]; then | |
| echo "Missing FK_BACKEND_ADMIN_TOKEN repository secret." >&2 | |
| exit 1 | |
| fi | |
| mkdir -p backups | |
| export_file="backups/fkdev-admin-export-$(date -u +%Y%m%dT%H%M%SZ).json" | |
| curl --fail --silent --show-error \ | |
| --retry 3 \ | |
| --retry-delay 10 \ | |
| --connect-timeout 20 \ | |
| --max-time 120 \ | |
| -H "Accept: application/json" \ | |
| -H "X-FK-Backend-Token: ${FK_BACKEND_ADMIN_TOKEN}" \ | |
| "${FK_BACKEND_EXPORT_URL}" \ | |
| -o "${export_file}" | |
| python -m json.tool "${export_file}" > "${export_file}.pretty" | |
| mv "${export_file}.pretty" "${export_file}" | |
| echo "EXPORT_FILE=${export_file}" >> "$GITHUB_ENV" | |
| - name: Upload export artifact | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: fkdev-admin-export | |
| path: ${{ env.EXPORT_FILE }} | |
| if-no-files-found: error | |
| retention-days: 90 |