wfxr.forgit/.github/scripts/changelog.sh
Tim 2d5f8f48f5
Some checks failed
ci / build (ubuntu-22.04) (push) Failing after 1s
ci / build (macos-latest) (push) Has been cancelled
ci / build (ubuntu-20.04) (push) Has been cancelled
Meta: do not create release when there are no public changes (#401)
2024-11-04 10:17:59 +01:00

37 lines
1.1 KiB
Bash
Executable file

#!/bin/bash
release_has_public_changes=false
url=$(git remote get-url origin | sed -r 's/(.*)\.git/\1/')
previous_tag=$(git describe --tags --abbrev=0 HEAD~)
echo "Changes since $previous_tag:"
echo
# Loop through all commits since previous tag
for rev in $(git log $previous_tag..HEAD --format="%H" --reverse --no-merges)
do
summary=$(git log $rev~..$rev --format="%s")
# Exclude commits starting with "Meta"
if [[ $summary != Meta* ]]
then
# Print markdown list of commit headlines
echo "* [$summary]($url/commit/$rev)"
# Append commit body indented (blank lines and signoff trailer removed)
git log $rev~..$rev --format="%b" | sed '/^\s*$/d' | sed '/^Signed-off-by:/d' | \
while read -r line
do
# Escape markdown formatting symbols _ * `
echo " $line" | sed 's/_/\\_/g' | sed 's/`/\\`/g' | sed 's/\*/\\\*/g'
done
release_has_public_changes=true
fi
done
if ! $release_has_public_changes
then
echo "No public changes since $previous_tag." >&2
exit 1
fi