name: Refresh catalog on: schedule: - cron: '17 8 * * *' workflow_dispatch: inputs: no_enrich: description: 'Skip paid extraction and assessment (use for the first verification)' type: boolean required: true default: true permissions: contents: write actions: write concurrency: group: catalog-refresh cancel-in-progress: false jobs: refresh: if: github.repository == 'iamnbutler/litrpg-hub' && github.ref == 'refs/heads/main' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') runs-on: ubuntu-latest timeout-minutes: 30 steps: - name: Check the UTC run window id: window run: | python3 - <<'PY' import datetime, os now = datetime.datetime.now(datetime.timezone.utc) end = now.replace(hour=22, minute=0, second=0, microsecond=0) allowed = now.hour >= 2 and now + datetime.timedelta(minutes=27) <= end with open(os.environ['GITHUB_OUTPUT'], 'a') as output: output.write('allowed=' + str(allowed).lower() + '\n') print('Catalog refresh may run with its checkpoint reserve.' if allowed else 'Catalog refresh skipped: outside the permitted UTC window or too close to 22:00 UTC.') PY - uses: actions/checkout@v4 if: steps.window.outputs.allowed == 'true' with: ref: main persist-credentials: false - uses: actions/setup-node@v4 if: steps.window.outputs.allowed == 'true' with: node-version: 22 cache: npm - run: npm ci if: steps.window.outputs.allowed == 'true' # No raw artifacts or child logs are uploaded from this public repository. # Root provisions the data-repository token; a minted GitHub App token can use this same input. - name: Restore, refresh, checkpoint privately, and publish public JSON if: steps.window.outputs.allowed == 'true' run: node --import tsx scripts/backend/automation/worker.ts env: GITHUB_TOKEN: ${{ github.token }} CATALOG_DATA_TOKEN: ${{ secrets.CATALOG_DATA_TOKEN }} OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} TYPESAFE_API_KEY: ${{ secrets.TYPESAFE_API_KEY }} CATALOG_OPENAI_MODEL: gpt-5.6-terra JEV_MODEL: jev-latest COVER_MODEL: gpt-4.1-mini CATALOG_NO_ENRICH: ${{ github.event_name == 'workflow_dispatch' && inputs.no_enrich || false }}