draft-change-log-entries.sh 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/bin/bash -e
  2. version=$("$(dirname "$0")/get-version.sh")
  3. if [[ $version =~ ([0-9]+)\.([0-9]+)\.0 ]]; then
  4. major="${BASH_REMATCH[1]}"
  5. minor="${BASH_REMATCH[2]}"
  6. else
  7. echo "unexpected version: $version"
  8. exit 1
  9. fi
  10. if [[ $minor == 0 ]]; then
  11. prior_major=$((major - 1))
  12. prior_minor=$(sed -n "s/^## Version $prior_major\.\([0-9]\+\)\..*/\1/p" CHANGELOG.md | head -1)
  13. if [[ -z $prior_minor ]]; then
  14. # assuming this is the first release
  15. range=
  16. else
  17. range="v$prior_major.$prior_minor.0..HEAD"
  18. fi
  19. else
  20. range="v$major.$((minor - 1)).0..HEAD"
  21. fi
  22. echo "## Unreleased"
  23. echo
  24. echo "### Migration notes"
  25. echo
  26. echo
  27. echo "### 🌟 New javaagent instrumentation"
  28. echo
  29. echo
  30. echo "### 🌟 New library instrumentation"
  31. echo
  32. echo
  33. echo "### 📈 Enhancements"
  34. echo
  35. echo
  36. echo "### 🛠️ Bug fixes"
  37. echo
  38. echo
  39. echo "### 🧰 Tooling"
  40. echo
  41. git log --reverse \
  42. --perl-regexp \
  43. --author='^(?!renovate\[bot\] )' \
  44. --pretty=format:"- %s" \
  45. "$range" \
  46. | sed -E 's,\(#([0-9]+)\)$,\n ([#\1](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/\1)),'