Skip to content

Instantly share code, notes, and snippets.

@Integralist
Last active March 30, 2023 12:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Integralist/e27f16821806aa8037c442d805fc2e44 to your computer and use it in GitHub Desktop.
Save Integralist/e27f16821806aa8037c442d805fc2e44 to your computer and use it in GitHub Desktop.
[Generate change log between two tags] #changelog #git
#!/bin/bash
tags=$(git for-each-ref --sort=-creatordate --format '%(refname) %(creatordate)' refs/tags | grep -Eo 'client/rust@v?[^ ]+')
latest_tag=$(echo "$tags" | head -n 1)
second_tag=$(echo "$tags" | head -n 2 | tail -1)
release_version=$(echo "$latest_tag" | cut -d @ -f 2)
# echo "all tags for this language: $tags"
# echo "latest tag: $latest_tag"
# echo "second tag: $second_tag"
changes=$(git log --pretty="- %s" "$latest_tag"..."$second_tag" --no-merges)
# echo "$changes"
# NOTE: xargs trims whitespace
printf "# \`v$release_version\`\n\n## CHANGES (commits: $(echo "$changes" | wc -l | xargs))\n\n$changes\n" > release_notes.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment