mirror of
https://gitee.com/houhuan/TrendRadar.git
synced 2025-12-21 21:57:17 +08:00
- 配置管理重构:统一使用 config/config.yaml - 运行模式升级:支持 daily/current/incremental 三种模式 - Docker 支持:完整容器化部署方案 - 新增配置文件:config/config.yaml 和 config/frequency_words.txt
64 lines
1.8 KiB
YAML
64 lines
1.8 KiB
YAML
name: Hot News Crawler
|
|
|
|
on:
|
|
schedule:
|
|
- cron: "*/30 * * * *" # 每 30 分钟运行一次
|
|
workflow_dispatch:
|
|
|
|
# 添加权限设置
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
crawl:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3
|
|
|
|
- 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: Verify required files
|
|
run: |
|
|
echo "🔍 检查必需的配置文件..."
|
|
|
|
if [ ! -f config/config.yaml ]; then
|
|
echo "❌ 错误: config/config.yaml 文件不存在"
|
|
echo "请参考项目文档创建配置文件"
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -f config/frequency_words.txt ]; then
|
|
echo "❌ 错误: config/frequency_words.txt 文件不存在"
|
|
echo "请参考项目文档创建频率词配置文件"
|
|
exit 1
|
|
fi
|
|
|
|
echo "✅ 配置文件检查通过"
|
|
|
|
- name: Run crawler
|
|
env:
|
|
FEISHU_WEBHOOK_URL: ${{ secrets.FEISHU_WEBHOOK_URL }}
|
|
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
|
|
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
|
|
DINGTALK_WEBHOOK_URL: ${{ secrets.DINGTALK_WEBHOOK_URL }}
|
|
WEWORK_WEBHOOK_URL: ${{ secrets.WEWORK_WEBHOOK_URL }}
|
|
GITHUB_ACTIONS: true
|
|
run: python main.py
|
|
|
|
- name: Commit and push if changes
|
|
run: |
|
|
git config --global user.name 'GitHub Actions'
|
|
git config --global user.email 'actions@github.com'
|
|
git add -A
|
|
git diff --quiet && git diff --staged --quiet || (git commit -m "Auto update by GitHub Actions at $(TZ=Asia/Shanghai date)" && git push)
|