fix:增加生成tag版本号时移除Merge和Revert操作对版本号进行递增的逻辑,增加对commit id 的去重
This commit is contained in:
parent
1220653526
commit
82df2f6e4b
@ -69,18 +69,30 @@ 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 # 用于去重
|
||||||
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_message=$(echo "$commit_json" | jq -r '.message')
|
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"
|
echo "----$commit_message"
|
||||||
if [[ "$commit_message" =~ ("feat:"*) ]] && [[ $new_minor == $minor ]]; then
|
if [[ "$commit_message" =~ ^feat: ]] && [[ $new_minor == $minor ]]; then
|
||||||
((new_minor++))
|
((new_minor++))
|
||||||
elif [[ "$commit_message" =~ ("fix:"*) ]]; then
|
elif [[ "$commit_message" =~ ^fix: ]]; then
|
||||||
((new_patch++))
|
|
||||||
elif [[ ! "$commit_message" =~ ("Merge"* | "Revert"*) ]]; then
|
|
||||||
((new_patch++))
|
((new_patch++))
|
||||||
fi
|
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"
|
next_tag="v${major}.${new_minor}.${new_patch}_sky"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user