rss-sync #191
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: rss-sync | |
| on: | |
| schedule: | |
| # 北京时间 00:00 (UTC 16:00) | |
| - cron: "0 16 * * *" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: rss-sync | |
| cancel-in-progress: true | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: "npm" | |
| - name: Install deps | |
| run: npm ci | |
| - name: Sync content | |
| env: | |
| AI_PROVIDER: ${{ secrets.AI_PROVIDER }} | |
| DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY }} | |
| DEEPSEEK_API_URL: ${{ secrets.DEEPSEEK_API_URL }} | |
| DEEPSEEK_MODEL: ${{ secrets.DEEPSEEK_MODEL }} | |
| OPENAI_COMPATIBLE_API_KEY: ${{ secrets.OPENAI_COMPATIBLE_API_KEY }} | |
| OPENAI_COMPATIBLE_API_URL: ${{ secrets.OPENAI_COMPATIBLE_API_URL }} | |
| OPENAI_COMPATIBLE_MODEL: ${{ secrets.OPENAI_COMPATIBLE_MODEL }} | |
| OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }} | |
| OPENROUTER_API_URL: ${{ secrets.OPENROUTER_API_URL }} | |
| OPENROUTER_MODEL: ${{ secrets.OPENROUTER_MODEL }} | |
| OPENROUTER_HTTP_REFERER: ${{ secrets.OPENROUTER_HTTP_REFERER }} | |
| OPENROUTER_X_TITLE: ${{ secrets.OPENROUTER_X_TITLE }} | |
| XAI_API_KEY: ${{ secrets.XAI_API_KEY }} | |
| XAI_API_URL: ${{ secrets.XAI_API_URL }} | |
| XAI_MODEL: ${{ secrets.XAI_MODEL }} | |
| ZHIPU_API_KEY: ${{ secrets.ZHIPU_API_KEY }} | |
| ZHIPU_API_URL: ${{ secrets.ZHIPU_API_URL }} | |
| ZHIPU_MODEL: ${{ secrets.ZHIPU_MODEL }} | |
| run: npm run sync | |
| - name: Commit if changed | |
| run: | | |
| if git diff --quiet -- src/data/episodes.json src/content/transcripts; then | |
| echo "No content changes." | |
| exit 0 | |
| fi | |
| MESSAGE="chore(content): sync rss" | |
| if git diff --name-only | grep -q '^src/content/transcripts/'; then | |
| MESSAGE="$MESSAGE + transcripts" | |
| fi | |
| if git diff -U0 -- src/data/episodes.json | grep -qE '^[+-][^+-].*"(tags|themeId)"'; then | |
| MESSAGE="$MESSAGE + tags" | |
| fi | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add src/data/episodes.json src/content/transcripts | |
| git commit -m "$MESSAGE" | |
| git push |