mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-01-06 01:20:29 +05:30
Merge pull request #5404 from Bnyro/master
refactor: improve script to generate changelogs
This commit is contained in:
commit
8f7a8e6bad
27
changelog.sh
27
changelog.sh
@ -2,12 +2,8 @@
|
|||||||
|
|
||||||
TEXT="$1"
|
TEXT="$1"
|
||||||
|
|
||||||
# the link containing the full commit history
|
|
||||||
FULLCHANGELOG=$(echo "$TEXT{@}" | tail -n 1)
|
|
||||||
NEWCONTRIBUTORS=$(echo "$TEXT{@}" | grep 'first contribution')
|
|
||||||
|
|
||||||
# remove everything related to weblate and dependencies
|
# remove everything related to weblate and dependencies
|
||||||
TEXT=$(printf "${TEXT[@]}" | sed -e 's/.*Weblate.*//g' -e 's/.*dependency.*//g' -e 's/^\*\*Full//g' -e 's/.*first contribution.*//g' -e 's/##.*//g')
|
TEXT=$(printf "${TEXT[@]}" | sed -e 's/.*Translations.*//g' -e 's/.*(fix|chore)\(deps\).*//g')
|
||||||
|
|
||||||
# go through all the lines inside the file
|
# go through all the lines inside the file
|
||||||
readarray -t y <<< "${TEXT[@]}"
|
readarray -t y <<< "${TEXT[@]}"
|
||||||
@ -21,15 +17,18 @@ trim() {
|
|||||||
printf '%s' "$var"
|
printf '%s' "$var"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Print all the found and categorized changes
|
TRIMMED=`trim "$(echo "$TEXT" | sort)"`
|
||||||
create_changelog() {
|
|
||||||
trim "$(echo "$TEXT" | sort)"
|
|
||||||
[ "$NEWCONTRIBUTORS" ] && echo -e "\n\n## New contributors\n$NEWCONTRIBUTORS"
|
|
||||||
echo -e "\n\n$FULLCHANGELOG"
|
|
||||||
}
|
|
||||||
|
|
||||||
# generate a new changelog
|
CHANGELOG=()
|
||||||
CHANGELOG=$(create_changelog)
|
CURRENTSECTION=""
|
||||||
|
while IFS= read -r line; do
|
||||||
|
SECTION=$(echo "$line" | cut -d ":" -f 1 | tr -d "*" | tr -d " " | sed "s/(.*)//g")
|
||||||
|
if [ "$SECTION" != "$CURRENTSECTION" ]; then
|
||||||
|
CHANGELOG+="\n## ${SECTION^}\n"
|
||||||
|
CURRENTSECTION="$SECTION"
|
||||||
|
fi
|
||||||
|
CHANGELOG+="$line\n"
|
||||||
|
done <<< "$TRIMMED"
|
||||||
|
|
||||||
# Output the generated changelog
|
# Output the generated changelog
|
||||||
echo "$CHANGELOG"
|
echo -e "$CHANGELOG"
|
||||||
|
Loading…
Reference in New Issue
Block a user