From 064e5ed542dede1e922ce4aa01daec623dbb75ed Mon Sep 17 00:00:00 2001 From: liyi Date: Tue, 3 Jun 2025 09:53:21 +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 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tag_generator.sh b/tag_generator.sh index acbca910..141408f9 100755 --- a/tag_generator.sh +++ b/tag_generator.sh @@ -69,17 +69,17 @@ else echo "compare_json:$compare_json\n" new_patch=$patch new_minor=$minor - declare -A seen_commits # 用于去重 + 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 + # commit id 去重(兼容所有 shell) + if echo "$seen_commits" | grep -q "$commit_id"; then continue fi - seen_commits[$commit_id]=1 + seen_commits="$seen_commits $commit_id" # 跳过 Merge 和 Revert 提交 if [[ "$commit_title" =~ ^Merge ]] || [[ "$commit_title" =~ ^Revert ]]; then