feat: add daily tip & case auto-publish system
- GitHub Actions workflow: daily-content.yml (UTC 00:00 / 北京 08:00) - Content generation script: .github/scripts/generate-daily.js (Claude API) - Initial data: website/daily/data.json - website/index.html: new 每日精选 section with bilingual support Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
38
.github/workflows/daily-content.yml
vendored
Normal file
38
.github/workflows/daily-content.yml
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
name: Daily Content Generator
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 0 * * *' # UTC 00:00 = 北京时间 08:00
|
||||
workflow_dispatch: # 支持手动触发测试
|
||||
|
||||
jobs:
|
||||
generate:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
|
||||
- name: Generate daily content
|
||||
env:
|
||||
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
||||
run: node .github/scripts/generate-daily.js
|
||||
|
||||
- name: Commit and push changes
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git add website/daily/data.json
|
||||
if git diff --staged --quiet; then
|
||||
echo "No changes to commit"
|
||||
else
|
||||
git commit -m "chore: update daily content $(date -u '+%Y-%m-%d')"
|
||||
git push
|
||||
fi
|
||||
Reference in New Issue
Block a user