From 82df2f6e4bdbf85d5f7c5227efee92438f735450 Mon Sep 17 00:00:00 2001 From: liyi Date: Tue, 3 Jun 2025 09:36:51 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E5=A2=9E=E5=8A=A0=E7=94=9F=E6=88=90tag?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8F=B7=E6=97=B6=E7=A7=BB=E9=99=A4Merge?= =?UTF-8?q?=E5=92=8CRevert=E6=93=8D=E4=BD=9C=E5=AF=B9=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=B7=E8=BF=9B=E8=A1=8C=E9=80=92=E5=A2=9E=E7=9A=84=E9=80=BB?= =?UTF-8?q?=E8=BE=91=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=AF=B9commit=20id=20?= =?UTF-8?q?=E7=9A=84=E5=8E=BB=E9=87=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tag_generator.sh | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/tag_generator.sh b/tag_generator.sh index 9ba43254..acbca910 100755 --- a/tag_generator.sh +++ b/tag_generator.sh @@ -69,18 +69,30 @@ else echo "compare_json:$compare_json\n" new_patch=$patch new_minor=$minor + declare -A seen_commits # 用于去重 while IFS= read -r commit_json; do commit_id=$(echo "$commit_json" | jq -r '.id') + commit_title=$(echo "$commit_json" | jq -r '.title') commit_message=$(echo "$commit_json" | jq -r '.message') + + # commit id 去重 + if [[ -n "${seen_commits[$commit_id]}" ]]; then + continue + fi + seen_commits[$commit_id]=1 + + # 跳过 Merge 和 Revert 提交 + if [[ "$commit_title" =~ ^Merge ]] || [[ "$commit_title" =~ ^Revert ]]; then + continue + fi + echo "----$commit_message" - if [[ "$commit_message" =~ ("feat:"*) ]] && [[ $new_minor == $minor ]]; then + if [[ "$commit_message" =~ ^feat: ]] && [[ $new_minor == $minor ]]; then ((new_minor++)) - elif [[ "$commit_message" =~ ("fix:"*) ]]; then - ((new_patch++)) - elif [[ ! "$commit_message" =~ ("Merge"* | "Revert"*) ]]; then + elif [[ "$commit_message" =~ ^fix: ]]; then ((new_patch++)) fi - done < <(echo "$compare_json" | jq -c '.commits[] | {id: .id, message: .message}') + done < <(echo "$compare_json" | jq -c '.commits[] | {id: .id, title: .title, message: .message}') next_tag="v${major}.${new_minor}.${new_patch}_sky" fi