Last active
June 17, 2022 15:20
-
-
Save chetan/286dfb5d4d94de6e4b828c84171171ad to your computer and use it in GitHub Desktop.
Generate changelog.md from github releases
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# generate initial changelog.md from release history | |
# requires gh and jq tools | |
echo -e "# Changelog\n" >> CHANGELOG.md | |
for rel in $(gh release list | awk '{print $1}'); do | |
echo "## ${rel}" >> CHANGELOG.md | |
echo "" >> CHANGELOG.md | |
gh release view --json body $rel | jq --raw-output '.body' | grep -v '^## Changelog' | sed -e 's/^#/##/g' >> CHANGELOG.md | |
echo "" >> CHANGELOG.md | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Update CHANGELOG.md with latest release | |
update-changelog: | |
echo -e "# Changelog\n" >> temp.md | |
rel=$$(gh release list | head -n 1 | awk '{print $$1}'); \ | |
echo "## $$rel" >> temp.md; \ | |
echo "" >> temp.md; \ | |
gh release view --json body $$rel | \ | |
jq --raw-output '.body' | \ | |
grep -v '^## Changelog' | \ | |
sed -e 's/^#/##/g' >> temp.md | |
cat CHANGELOG.md | grep -v '^# Changelog' >> temp.md | |
mv temp.md CHANGELOG.md |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment