maintain-supabase #224
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: maintain-supabase | |
| on: | |
| schedule: | |
| - cron: "30 0 * * *" # 北京时间次日 08:30(UTC 00:30) | |
| - cron: "30 8 * * *" # 北京时间次日 16:30(UTC 08:30) | |
| - cron: "30 16 * * *" # 北京时间次日 00:30(UTC 16:30) | |
| workflow_dispatch: | |
| inputs: | |
| fetch_days: | |
| description: "回溯抓取天数(例如 9);留空则使用 9 天默认值" | |
| required: false | |
| default: "9" | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: daily-paper-reader-maintain | |
| cancel-in-progress: false | |
| jobs: | |
| maintain_supabase: | |
| if: github.repository == 'ziwenhahaha/daily-paper-reader' || github.repository == '5-xj/daily-paper-reader' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 120 | |
| env: | |
| SUPABASE_URL: https://lyucdwgefyfbmaiopjbk.supabase.co | |
| SUPABASE_SCHEMA: public | |
| SUPABASE_SERVICE_KEY: ${{ secrets.SUPABASE_SERVICE_KEY }} | |
| SUPABASE_BACKEND_KEY: arxiv | |
| SUPABASE_PAPERS_TABLE: arxiv_papers | |
| SUPABASE_RETENTION_DAYS: "45" | |
| PYTHONUNBUFFERED: "1" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Setup Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.11" | |
| - name: Cache pip + torch | |
| uses: actions/cache@v5 | |
| with: | |
| path: | | |
| ~/.cache/pip | |
| ~/.cache/torch | |
| key: ${{ runner.os }}-dpr-hf-v2-${{ hashFiles('requirements.txt') }} | |
| - name: Install deps (skip sqlite3) | |
| run: | | |
| python - <<'PY' | |
| import re | |
| lines = open("requirements.txt", "r", encoding="utf-8").read().splitlines() | |
| lines = [l for l in lines if l.strip() and not re.match(r"^sqlite3\\b", l)] | |
| open("/tmp/req.txt", "w", encoding="utf-8").write("\n".join(lines)) | |
| PY | |
| python -m pip install --upgrade pip | |
| python -m pip install uv | |
| uv pip install --system -r /tmp/req.txt | |
| - name: Run arXiv Maintain Pipeline | |
| run: | | |
| set -euo pipefail | |
| set -x | |
| if [ -z "${SUPABASE_SERVICE_KEY}" ]; then | |
| echo "[WARN] 未配置 SUPABASE_SERVICE_KEY,已跳过维护同步。" | |
| exit 0 | |
| fi | |
| FETCH_DAYS="${{ github.event.inputs.fetch_days }}" | |
| if [ -z "$FETCH_DAYS" ]; then | |
| FETCH_DAYS="9" | |
| fi | |
| ARGS=(--fetch-days "$FETCH_DAYS") | |
| python src/maintain/arxiv.py "${ARGS[@]}" |