fix:增加生成tag版本号时移除Merge和Revert操作对版本号进行递增的逻辑,增加对commit id 的去重

This commit is contained in:
liyi 2025-06-03 09:53:21 +08:00
parent 82df2f6e4b
commit 064e5ed542

View File

@ -69,17 +69,17 @@ else
echo "compare_json:$compare_json\n" echo "compare_json:$compare_json\n"
new_patch=$patch new_patch=$patch
new_minor=$minor new_minor=$minor
declare -A seen_commits # 用于去重 seen_commits="" # 用于去重
while IFS= read -r commit_json; do while IFS= read -r commit_json; do
commit_id=$(echo "$commit_json" | jq -r '.id') commit_id=$(echo "$commit_json" | jq -r '.id')
commit_title=$(echo "$commit_json" | jq -r '.title') commit_title=$(echo "$commit_json" | jq -r '.title')
commit_message=$(echo "$commit_json" | jq -r '.message') commit_message=$(echo "$commit_json" | jq -r '.message')
# commit id 去重 # commit id 去重(兼容所有 shell
if [[ -n "${seen_commits[$commit_id]}" ]]; then if echo "$seen_commits" | grep -q "$commit_id"; then
continue continue
fi fi
seen_commits[$commit_id]=1 seen_commits="$seen_commits $commit_id"
# 跳过 Merge 和 Revert 提交 # 跳过 Merge 和 Revert 提交
if [[ "$commit_title" =~ ^Merge ]] || [[ "$commit_title" =~ ^Revert ]]; then if [[ "$commit_title" =~ ^Merge ]] || [[ "$commit_title" =~ ^Revert ]]; then