draft-change-log-entries.sh 671 B

12345678910111213141516171819202122
  1. #!/bin/bash -e
  2. version=$(grep -Eo "[0-9]+.[0-9]+.0" version.gradle.kts | head -1)
  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=$(grep -Po "^## Version $prior_major.\K([0-9]+)" CHANGELOG.md | head -1)
  13. prior_version="$prior_major.$prior_minor"
  14. else
  15. prior_version="$major.$((minor - 1)).0"
  16. fi
  17. git log --reverse --pretty=format:"- %s" "v$prior_version"..HEAD \
  18. | sed -r 's,\(#([0-9]+)\),\n ([#\1](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/\1)),'