diff --git a/.github/workflows/update_contributors_images.yml b/.github/workflows/update_contributors_images.yml index 55f39e644..44ea49432 100644 --- a/.github/workflows/update_contributors_images.yml +++ b/.github/workflows/update_contributors_images.yml @@ -18,12 +18,19 @@ jobs: avatarSize: 42 - name: Modify README.md - uses: jaywcjlove/github-action-modify-file-content@v1.4.4 - with: - token: ${{ secrets.CI_GITHUB_TOKEN }} - path: README.md - openDelimiter: '' - closeDelimiter: '' - message: '修改文档: 更新`贡献者列表`' - body: | - ${{steps.contributors.outputs.htmlList}} + run: | + escapedHtmlList=$(echo -e '${{steps.contributors.outputs.htmlList}}' | sed ':a;N;$!ba;s/\n/\\r\\n/g;s/\\r\\n$//') + openDelimiter='' + closeDelimiter='' + 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>"