From 29de2eadf8dcafcddee5f280cfaaf509f3ba8615 Mon Sep 17 00:00:00 2001 From: hotyue <52734432+hotyue@users.noreply.github.com> Date: Mon, 13 Apr 2026 08:17:51 +0000 Subject: [PATCH] =?UTF-8?q?ci(workflows):=20=F0=9F=A4=96=20=E9=83=A8?= =?UTF-8?q?=E7=BD=B2=20OTA=20=E5=8A=A8=E6=80=81=E8=AF=8D=E5=BA=93=E6=AF=8F?= =?UTF-8?q?=E6=97=A5=E8=87=AA=E5=8A=A8=E7=94=9F=E6=88=90=E6=B5=81=E6=B0=B4?= =?UTF-8?q?=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/daily_keywords.yml | 49 ++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/daily_keywords.yml diff --git a/.github/workflows/daily_keywords.yml b/.github/workflows/daily_keywords.yml new file mode 100644 index 0000000..be3bdeb --- /dev/null +++ b/.github/workflows/daily_keywords.yml @@ -0,0 +1,49 @@ +name: Daily Trends Factory + +on: + schedule: + # 每天 UTC 18:00 运行 (北京时间凌晨 02:00) + - cron: '0 18 * * *' + workflow_dispatch: + +permissions: + contents: write + +jobs: + update-trends: + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.10' + + - name: Execute Trends Engine + run: python scripts/fetch_trends.py + + - name: Commit and Force Push + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + + git add data/keywords/ + + if git diff --staged --quiet; then + echo "No changes, skipping." + exit 0 + fi + + # 策略:如果上一次是机器人提交的,就直接覆盖它 + LAST_AUTHOR=$(git log -1 --format='%an') + if [ "$LAST_AUTHOR" = "github-actions[bot]" ]; then + git commit --amend -m "chore(data): 🤖 自动机兵:刷新全战区热点词库 [v3.3.0 OTA]" + else + git commit -m "chore(data): 🤖 自动机兵:刷新全战区热点词库 [v3.3.0 OTA]" + fi + + git push --force origin main \ No newline at end of file