-
Notifications
You must be signed in to change notification settings - Fork 4
60 lines (48 loc) · 2.18 KB
/
main.yml
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
49
50
51
52
53
54
55
56
57
58
59
60
name: Update README with Sorted Papers Content
on:
push:
paths:
- 'update_template_or_data/update_paper_list.md' # 监听 update_paper_list.md 文件的更新
- 'update_template_or_data/utils/scripts/sort_by_date.py' # 监听 update_template_or_data/utils/scripts/sort_by_date.py 脚本的更新
- 'update_template_or_data/update_readme_template.md' # 监听 update_template_or_data/utils/scripts/sort_by_date.py 脚本的更新
- '.github/workflows/main.yml'
# schedule:
# - cron: '0 0 * * *' # 每天定时运行(0点)
jobs:
update-readme:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python environment
uses: actions/setup-python@v2
with:
python-version: '3.10' # 使用最新的 Python 版本
- name: Install dependencies
run: |
pip install pandas matplotlib seaborn wordcloud
- name: Run update_template_or_data/utils/scripts/sort_by_date.py
run: |
python update_template_or_data/utils/scripts/sort_by_date.py
- name: Update temp_readme.md with sorted papers content
run: |
# 读取更新后的 update_template_or_data/update_paper_list.md 内容
CONTENT=$(cat update_template_or_data/update_paper_list.md)
# 使用 sed 插入 content 到 temp_readme.md 的占位符位置
sed -i '/{{insert_all_papers_here}}/{
r /dev/stdin
d
}' update_template_or_data/update_readme_template.md <<< "$CONTENT"
- name: Overwrite README.md with updated temp_readme.md
run: |
# 覆盖 README.md
cp update_template_or_data/update_readme_template.md README.md
- name: Commit changes
run: |
git config --global user.name "github-actions"
git config --global user.email "[email protected]"
git add README.md grouped_by_env grouped_by_authors
git commit -m "Update README with sorted content from update_template_or_data/update_paper_list.md"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}