From 2496fca391505eec6c392e4a55983ca1a16143f6 Mon Sep 17 00:00:00 2001 From: liyp Date: Thu, 10 Apr 2025 16:37:20 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E5=86=99=E8=AE=B0=E5=BD=95readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/AutoGenerateREADME.yaml | 34 +++++++++++++----------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/.gitea/workflows/AutoGenerateREADME.yaml b/.gitea/workflows/AutoGenerateREADME.yaml index 606e57f..6a2661a 100644 --- a/.gitea/workflows/AutoGenerateREADME.yaml +++ b/.gitea/workflows/AutoGenerateREADME.yaml @@ -35,24 +35,28 @@ jobs: rm README.md fi - - name: 添加项目标题到README.md文件 + - name: 生成提交历史记录 + id: commit-history run: | - echo "# ActionDemo测试文档标题" > README.md + COMMIT_HISTORY=$(git log --pretty=format:"- %cd %h %an: %s" --date=short) + echo "::set-output name=commit_history::$COMMIT_HISTORY" - # - name : 获取提交记录到README.md文件 - # run: | - # # 获取提交记录并追加到 README.md - # git log --pretty=format:"- %h %ad %s" --date=short >> README.md - - - name: 获取版本发布记录到README.md文件 + - name: 生成Release历史记录 + id: release-history run: | - echo "## 版本发布记录" >> README.md - # 获取标签信息并格式化输出 - git tag -l --sort=-creatordate | while read tag; do - tag_date=$(git log -1 --format=%ad --date=short $tag) - tag_message=$(git tag -n9 $tag | sed 's/^[[:space:]]*//') - echo "- **$tag** ($tag_date): $tag_message" >> README.md - done + RELEASE_HISTORY=$(gh release list --limit 100 --json tagName,publishedAt,body --template '{{range .}}- {{.publishedAt}} {{.tagName}}: {{.body}}{{"\n"}}{{end}}') + echo "::set-output name=release_history::$RELEASE_HISTORY" + + - name: 将提交和Release记录添加到README.md + run: | + { + echo + echo "# 提交历史记录" + echo "${{ steps.commit-history.outputs.commit_history }}" + echo + echo "# Release历史记录" + echo "${{ steps.release-history.outputs.release_history }}" + } >> README.md - name: 重新提交仓库 env: