41 lines
1.0 KiB
YAML
41 lines
1.0 KiB
YAML
name: Auto RSS Fetch
|
|
|
|
on:
|
|
schedule:
|
|
- cron: '0 */6 * * *' # 每6小时运行一次
|
|
workflow_dispatch: # 允许手动触发
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
# 这一步非常重要:赋予脚本写入仓库的权限
|
|
permissions:
|
|
contents: write
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.9'
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
pip install -r requirements.txt
|
|
|
|
- name: Run RSS Script
|
|
env:
|
|
RSS_KEYWORDS: ${{ secrets.RSS_KEYWORDS }}
|
|
run: python get_RSS.py
|
|
|
|
- name: Commit and Push changes
|
|
run: |
|
|
git config --global user.name 'github-actions[bot]'
|
|
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
|
|
git add filtered_feed.xml
|
|
# 只有当有新文件生成或文件变动时才提交
|
|
git commit -m "Auto-update RSS feed" || echo "No changes to commit"
|
|
git push |