fix(changelog): show if there are no changes (#12934)
This commit is contained in:
parent
1bae199736
commit
4e29c670a4
1 changed files with 14 additions and 1 deletions
|
@ -400,6 +400,9 @@ function display-release {
|
||||||
function display:breaking {
|
function display:breaking {
|
||||||
(( $#breaking != 0 )) || return 0
|
(( $#breaking != 0 )) || return 0
|
||||||
|
|
||||||
|
# If we reach here we have shown commits, set flag
|
||||||
|
shown_commits=1
|
||||||
|
|
||||||
case "$output" in
|
case "$output" in
|
||||||
text) printf '\e[31m'; fmt:header "BREAKING CHANGES" 3 ;;
|
text) printf '\e[31m'; fmt:header "BREAKING CHANGES" 3 ;;
|
||||||
raw) fmt:header "BREAKING CHANGES" 3 ;;
|
raw) fmt:header "BREAKING CHANGES" 3 ;;
|
||||||
|
@ -427,6 +430,9 @@ function display-release {
|
||||||
# If no commits found of type $type, go to next type
|
# If no commits found of type $type, go to next type
|
||||||
(( $#hashes != 0 )) || return 0
|
(( $#hashes != 0 )) || return 0
|
||||||
|
|
||||||
|
# If we reach here we have shown commits, set flag
|
||||||
|
shown_commits=1
|
||||||
|
|
||||||
fmt:header "${TYPES[$type]}" 3
|
fmt:header "${TYPES[$type]}" 3
|
||||||
for hash in $hashes; do
|
for hash in $hashes; do
|
||||||
echo " - $(fmt:hash) $(fmt:scope)$(fmt:subject)"
|
echo " - $(fmt:hash) $(fmt:scope)$(fmt:subject)"
|
||||||
|
@ -444,6 +450,9 @@ function display-release {
|
||||||
# If no commits found under "other" types, don't display anything
|
# If no commits found under "other" types, don't display anything
|
||||||
(( $#changes != 0 )) || return 0
|
(( $#changes != 0 )) || return 0
|
||||||
|
|
||||||
|
# If we reach here we have shown commits, set flag
|
||||||
|
shown_commits=1
|
||||||
|
|
||||||
fmt:header "Other changes" 3
|
fmt:header "Other changes" 3
|
||||||
for hash type in ${(kv)changes}; do
|
for hash type in ${(kv)changes}; do
|
||||||
case "$type" in
|
case "$type" in
|
||||||
|
@ -498,7 +507,7 @@ function main {
|
||||||
|
|
||||||
# Commit classification arrays
|
# Commit classification arrays
|
||||||
local -A types subjects scopes breaking reverts
|
local -A types subjects scopes breaking reverts
|
||||||
local truncate=0 read_commits=0
|
local truncate=0 read_commits=0 shown_commits=0
|
||||||
local version tag
|
local version tag
|
||||||
local hash refs subject body
|
local hash refs subject body
|
||||||
|
|
||||||
|
@ -569,6 +578,10 @@ function main {
|
||||||
echo " ...more commits omitted"
|
echo " ...more commits omitted"
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if (( ! shown_commits )); then
|
||||||
|
echo "No changes to mention."
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Use raw output if stdout is not a tty
|
# Use raw output if stdout is not a tty
|
||||||
|
|
Loading…
Reference in a new issue