Generate RSS Feed #107
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: Generate RSS Feed | |
on: | |
push: | |
branches: | |
- master # 或你想要的分支 | |
paths: | |
- '.github/workflows/rss_generator.yml' | |
- 'rss_generator.py' | |
- 'config.yaml' | |
schedule: | |
- cron: '0 0 * * *' # 每天运行一次 | |
workflow_dispatch: # 允许手动触发 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.9' # 或其他你需要的版本 | |
- name: Install dependencies | |
run: | | |
sudo apt-get install -y chromium-browser | |
pip install -r requirements.txt # 确保requirements.txt包含selenium和其他依赖 | |
- name: Run RSS generator | |
env: | |
DISPLAY: ':99' # 设置无头浏览器显示 | |
run: | | |
Xvfb :99 -ac & | |
python rss_generator.py # 运行你的Python脚本 | |
- name: Download Microsoft Research Feed | |
run: | | |
curl -o rss/MicrosoftResearch.xml https://www.microsoft.com/en-us/research/feed/ | |
- name: Commit and push changes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # 使用GITHUB_TOKEN | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git add rss/* | |
git commit -m "Update RSS feeds" | |
git remote set-url --push origin https://xxcdd:[email protected]/xxcdd/web2rss | |
git push origin master |