forked from Mr-xn/Penetration_Testing_POC
-
Notifications
You must be signed in to change notification settings - Fork 2
48 lines (39 loc) · 1.34 KB
/
rss_update.yml
File metadata and controls
48 lines (39 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: Update README with RSS
on:
schedule:
- cron: '0 */3 * * *'
workflow_dispatch:
jobs:
update-readme:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11' # 推荐明确指定版本
# 创建并激活虚拟环境安装依赖
- name: Install dependencies
run: |
python -m venv venv
source venv/bin/activate
pip install feedparser requests
# 在运行脚本时也使用该虚拟环境
- name: Run update script
run: |
source venv/bin/activate
python scripts/update_readme.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 README.md
# 如果脚本未生成 commit message 文件,则使用默认值
if [ ! -f .commit_titles.txt ]; then
echo "docs: auto update RSS [skip ci]" > .commit_titles.txt
fi
git diff --quiet && git diff --staged --quiet || (git commit -F .commit_titles.txt && git push)
rm -f .commit_titles.txt