Skip to content

fix(ci): workflow 拉全量 12 个月 + 重建模式 #7

fix(ci): workflow 拉全量 12 个月 + 重建模式

fix(ci): workflow 拉全量 12 个月 + 重建模式 #7

Workflow file for this run

name: 每日数据更新 · Daily Update
on:
schedule:
# 北京时间 18:30 = UTC 10:30;周一到周五 (1-5)
# 注意:GitHub cron 可能延迟 5–30 分钟(非保证)
- cron: '30 10 * * 1-5'
workflow_dispatch: # 允许手动触发
permissions:
contents: write # 让 Action 能 commit + push 回 main
concurrency:
group: daily-update
cancel-in-progress: false
jobs:
update:
runs-on: ubuntu-latest
timeout-minutes: 25
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
# 注意:update_daily 是完全重建模式,需要完整历史 (~12 个月) 才能
# 重新算出从 2025-07-11 开始的 equity_curve / monthly_returns。
# BaoStock 走自家 TCP (data.baostock.com:31322),不被 GitHub runner 防火墙拦。
- name: 1️⃣ Fetch A-share data (BaoStock, ~12 个月)
run: python build/fetch_data.py --start 2025-06-15
timeout-minutes: 15
- name: 2️⃣ Run model inference (m2alpha.pt)
run: python build/inference.py
timeout-minutes: 5
- name: 3️⃣ Rebuild docs/data/data.json (strategy: 行业分散 top-10 + 滞后带)

Check failure on line 50 in .github/workflows/daily-update.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/daily-update.yml

Invalid workflow file

You have an error in your yaml syntax on line 50
run: python build/update_daily.py
- name: 4️⃣ Commit + push if changed
env:
GH_USER: ${{ github.actor }}
run: |
git config user.name "M²-Alpha Bot"
git config user.email "actions@users.noreply.github.com"
git add docs/data/data.json
if git diff --cached --quiet; then
echo "no changes."
exit 0
fi
STAMP=$(date -u +%Y-%m-%d)
git commit -m "data: 每日更新 ${STAMP}"
git push