gh-cli-for-release-notes.sh 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/usr/bin/env bash
  2. #
  3. # Helper script to prepare changelog for a release.
  4. #
  5. # It filters GitHub issues and pull requests for the specified milestone and
  6. # prints a list on standard output. The generated list needs to be reviewed by
  7. # a maintainer before including it to the CHANGELOG.
  8. #
  9. # It uses GitHub CLI from https://github.com/cli/cli
  10. #
  11. # Usage: gh-cli-release-notes.sh <GitHub milestone name>
  12. #
  13. if [[ $# -eq 0 ]] ; then
  14. echo 'Usage: gh-cli-release-notes.sh <GitHub milestone name>'
  15. exit 1
  16. fi
  17. MILESTONE=$1
  18. echo
  19. echo "${MILESTONE} ($(date "+%Y-%m-%d"))"
  20. echo ===========================
  21. echo
  22. echo "Summary of Changes:"
  23. echo
  24. echo "Breaking Changes:"
  25. echo
  26. gh issue list -S 'milestone:"'"${MILESTONE}"'" label:breaking' -s all -L 500 --json number,title --jq '.[] | "- GH #\(.number) \(.title)"'
  27. gh pr list -S 'milestone:"'"${MILESTONE}"'" label:breaking' -s all -L 500 --json number,title --jq '.[] | "- PR #\(.number) \(.title)"'
  28. echo
  29. echo "Security Fixes:"
  30. echo
  31. gh issue list -S 'milestone:"'"${MILESTONE}"'" -label:breaking label:security' -s all -L 500 --json number,title --jq '.[] | "- GH #\(.number) \(.title)"'
  32. gh pr list -S 'milestone:"'"${MILESTONE}"'" -label:breaking label:security' -s all -L 500 --json number,title --jq '.[] | "- PR #\(.number) \(.title)"'
  33. echo
  34. echo "Features, Enhancements and Third Party Updates:"
  35. echo
  36. gh issue list -S 'milestone:"'"${MILESTONE}"'" -label:breaking -label:security label:enhancement' -s all -L 500 --json number,title --jq '.[] | "- GH #\(.number) \(.title)"'
  37. gh issue list -S 'milestone:"'"${MILESTONE}"'" -label:breaking -label:security -label:enhancement label:feature' -s all -L 500 --json number,title --jq '.[] | "- GH #\(.number) \(.title)"'
  38. gh issue list -S 'milestone:"'"${MILESTONE}"'" -label:breaking -label:security -label:enhancement -label:feature label:third-party' -s all -L 500 --json number,title --jq '.[] | "- GH #\(.number) \(.title)"'
  39. gh pr list -S 'milestone:"'"${MILESTONE}"'" -label:breaking -label:security label:enhancement' -s all -L 500 --json number,title --jq '.[] | "- PR #\(.number) \(.title)"'
  40. gh pr list -S 'milestone:"'"${MILESTONE}"'" -label:breaking -label:security -label:enhancement label:feature' -s all -L 500 --json number,title --jq '.[] | "- PR #\(.number) \(.title)"'
  41. gh pr list -S 'milestone:"'"${MILESTONE}"'" -label:breaking -label:security -label:enhancement -label:feature label:third-party' -s all -L 500 --json number,title --jq '.[] | "- PR #\(.number) \(.title)"'
  42. echo
  43. echo "Bug Fixes and Improvements:"
  44. echo
  45. gh issue list -S 'milestone:"'"${MILESTONE}"'" -label:breaking -label:enhancement -label:feature -label:security -label:third-party' -s all -L 500 --json number,title --jq '.[] | "- GH #\(.number) \(.title)"'
  46. gh pr list -S 'milestone:"'"${MILESTONE}"'" -label:breaking -label:enhancement -label:feature -label:security -label:third-party' -s all -L 500 --json number,title --jq '.[] | "- PR #\(.number) \(.title)"'
  47. echo