Created
June 30, 2025 19:03
-
-
Save nikoheikkila/a7ec75ce6cd3240c0d2173ec7066e02e to your computer and use it in GitHub Desktop.
A quick and dirty changelog generator for Bash
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
#!/usr/bin/env bash | |
set -euo pipefail | |
SINCE="${1:-HEAD~1}" | |
query_log() { | |
local type="$1" | |
local pattern="^${type}\(.*\):\s" | |
local GH_HOST="github.com" | |
local owner="nikoheikkila" | |
local repository="nikoheikkila.fi" | |
local commit_url="https://${GH_HOST}/${owner}/${repository}/commit/%H" | |
git log --grep "${pattern}" --pretty="- %s [(\`%h\`)](${commit_url})" "${SINCE}...HEAD" | |
echo "" | |
} | |
{ | |
echo "### New Features" | |
query_log "feat" | |
echo "### Bug Fixes" | |
query_log "fix" | |
echo "### Documentation" | |
query_log "docs" | |
} > CHANGELOG.md | |
pandoc -s -f markdown -t markdown+smart -o CHANGELOG.md --metadata title="Release Notes" CHANGELOG.md | |
pandoc -s -f markdown+smart -t html -o CHANGELOG.html --metadata title="Release Notes" CHANGELOG.md |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment