抓取並上傳 RSS #11788
This file contains 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 | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
paths: | |
- '.github/workflows/fetch.yml' | |
- 'code/*.py' | |
schedule: | |
- cron: '*/5 * * * *' # 每隔 5 分鐘運行一次 | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 檢出代碼 | |
uses: actions/checkout@v4 | |
- name: Run RSSHub docker | |
run: | | |
docker run -d --name rsshub -p 1200:1200 diygod/rsshub:chromium-bundled | |
- name: 設置 Python 環境 | |
uses: actions/setup-python@v5 | |
with: | |
# python-version: '3.12' | |
check-latest: true | |
- name: 安裝依賴 | |
run: | | |
python -m pip install --upgrade pip niquests niquests[speedups] qh3 feedgen bs4 | |
- name: 執行 Python 腳本 | |
run: | | |
python code/rss.py | |
python code/rsss.py | |
- name: 上傳 RSS 文件 | |
if: success() | |
run: | | |
git config --global user.email "github-actions@github.com" | |
git config --global user.name "github-actions" | |
git add *.rss | |
git commit -m "Upload RSS file" | |
git stash | |
git push |