-
Notifications
You must be signed in to change notification settings - Fork 179
34 lines (27 loc) · 1.14 KB
/
update-contributors.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
name: Update Contributors
on:
schedule:
- cron: '0 0 * * *' # 每天运行一次
workflow_dispatch:
jobs:
update-contributors:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Generate contributors list
run: |
curl -s https://api.github.com/repos/cr4n5/XiaoYuanKouSuan/contributors | jq -r '.[] | "<a href=\"\(.html_url)\"><img src=\"\(.avatar_url)&s=100\" width=\"50\" height=\"50\" alt=\"\(.login)\" /></a>"' > CONTRIBUTORS.md
- name: Remove old contributors
run: |
awk '/<!-- CONTRIBUTORS-START -->/{print;flag=1;next}/<!-- CONTRIBUTORS-END -->/{flag=0}flag{next}1' README.md > README.tmp && mv README.tmp README.md
- name: Add new contributors
run: |
sed -i '/<!-- CONTRIBUTORS-START -->/r CONTRIBUTORS.md' README.md
- name: Commit 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
git commit -m 'Update contributors list'
git push