From b08caff16c29175a116d61b4a84c67cba21f7d8d Mon Sep 17 00:00:00 2001 From: Leonmmcoset Date: Sat, 6 Sep 2025 18:16:28 +0800 Subject: [PATCH] =?UTF-8?q?ci(workflow):=20=E6=94=B9=E8=BF=9B=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E6=8F=90=E4=BA=A4=E6=A3=80=E6=B5=8B=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 使用正则表达式更准确地检测初始提交,避免误判40字符SHA值为"initial-commit" --- .github/workflows/release-auto-commit.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release-auto-commit.yml b/.github/workflows/release-auto-commit.yml index b31fb45..d0cf338 100644 --- a/.github/workflows/release-auto-commit.yml +++ b/.github/workflows/release-auto-commit.yml @@ -25,7 +25,8 @@ jobs: - name: Generate commit log id: commit_log run: | - if [ "${{ steps.prev_tag.outputs.prev_tag }}" = "initial-commit" ]; then + # 检查是否是初始commit(SHA值通常是40个字符的十六进制数) + if [[ "${{ steps.prev_tag.outputs.prev_tag }}" =~ ^[0-9a-fA-F]{40}$ ]]; then COMMIT_LOG=$(git log --pretty=format:"- [%h] %s" --reverse) else COMMIT_LOG=$(git log ${{ steps.prev_tag.outputs.prev_tag }}..HEAD --pretty=format:"- [%h] %s" --reverse)