Daily Recovery snapshot #30
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: Daily Recovery snapshot | |
| # Runs once a day. Auto-resumes the paused Aura instance, queries it, | |
| # regenerates docs/snapshot/index.html, commits if changed, then PAUSES | |
| # the instance again. Total instance uptime per run is ~2-3 minutes — | |
| # critical for keeping hackathon credits intact on professional-db tier | |
| # (which does NOT auto-pause; only Free/AuraDS do). | |
| # | |
| # The committed HTML contains only Recovery % + zone + date + streak | |
| # counts. Raw biometric values never leave the runner. | |
| on: | |
| schedule: | |
| # 06:30 UTC = 08:30 CEST in summer / 07:30 CET in winter | |
| - cron: "30 6 * * *" | |
| workflow_dispatch: {} # allow manual runs from the Actions tab | |
| permissions: | |
| contents: write # commit the snapshot back | |
| concurrency: | |
| group: snapshot | |
| cancel-in-progress: false | |
| jobs: | |
| snapshot: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| # The renderer queries the Aura GraphQL Data API via the | |
| # AURA_GRAPHQL_URL + AURA_GRAPHQL_API_KEY secrets. Optional Aura M2M | |
| # secrets are kept around so the script can auto-resume a paused | |
| # instance via the v1 management API. | |
| - name: Render dashboard | |
| env: | |
| AURA_GRAPHQL_URL: ${{ secrets.AURA_GRAPHQL_URL }} | |
| AURA_GRAPHQL_API_KEY: ${{ secrets.AURA_GRAPHQL_API_KEY }} | |
| AURA_INSTANCEID: ${{ secrets.AURA_INSTANCEID }} | |
| AURA_CLIENT_ID: ${{ secrets.AURA_CLIENT_ID }} | |
| AURA_CLIENT_SECRET: ${{ secrets.AURA_CLIENT_SECRET }} | |
| run: python scripts/render_dashboard.py | |
| - name: Commit if changed | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| if git diff --quiet docs/snapshot/index.html; then | |
| echo "No change in snapshot." | |
| else | |
| git add docs/snapshot/index.html | |
| git commit -m "snapshot: $(date -u +%Y-%m-%d)" | |
| git push | |
| fi | |
| # Pause the instance to stop credit drain. | |
| # `if: always()` so we still pause even if render or commit failed — | |
| # the worst case is the instance stays running, which is exactly | |
| # what we're trying to avoid. Costs ~$7-10/day on professional-db. | |
| - name: Pause Aura instance | |
| if: always() | |
| env: | |
| AURA_INSTANCEID: ${{ secrets.AURA_INSTANCEID }} | |
| AURA_CLIENT_ID: ${{ secrets.AURA_CLIENT_ID }} | |
| AURA_CLIENT_SECRET: ${{ secrets.AURA_CLIENT_SECRET }} | |
| run: bash scripts/aura_pause.sh pause |