-
Notifications
You must be signed in to change notification settings - Fork 458
36 lines (32 loc) · 1.43 KB
/
update_contributors_images.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
name: Update contributors images in README.md
on:
workflow_dispatch:
jobs:
build-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.CI_GITHUB_TOKEN }} # 要绕过分支保护规则此处不可少
- name: Generate Contributors Images
uses: jaywcjlove/github-action-contributors@v1.3.5
id: contributors
with:
filter-author: (renovate\[bot\]|renovate-bot|@github-actions-bot|dependabot\[bot\]|ImgBotApp)
avatarSize: 42
- name: Modify README.md
run: |
escapedHtmlList=$(echo -e '${{steps.contributors.outputs.htmlList}}' | sed ':a;N;$!ba;s/\n/\\n/g;s/\\n$//')
openDelimiter='<!--AUTO_GENERATED_PLEASE_DONT_DELETE_IT-->'
closeDelimiter='<!--AUTO_GENERATED_PLEASE_DONT_DELETE_IT-END-->'
sed -i "/$openDelimiter/,/$closeDelimiter/c\\$openDelimiter$escapedHtmlList$closeDelimiter" README.md
git diff --quiet --exit-code README.md || echo "CHANGES_DETECTED=true" >> $GITHUB_ENV
- name: Commit and push README.md
if: ${{ env.CHANGES_DETECTED == 'true' }}
run: |
bash script/ci_commit_with_signature.sh \
${{ secrets.CI_GITHUB_TOKEN }} \
"maboloshi/github-chinese" \
"README.md" \
"修改文档: 更新\`贡献者列表\`" \
"Signed-off-by: 沙漠之子 <7850715+maboloshi@users.noreply.github.com>"