campusBooks / .github /workflows /update-data.yml
Song
hi
7e52205
raw
history blame contribute delete
938 Bytes
name: Weekly Data Update
on:
schedule:
- cron: '0 9 * * 1' # 每週一 UTC 9:00(台北時間 17:00)
workflow_dispatch: # 允許手動觸發
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run scraper and update data
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: python scrape_new_books.py
- name: Commit and push local changes (optional backup)
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add data.json
git commit -m "Weekly local update" || echo "No changes to commit"
git push