88# 2023-10-10: Copied from earthdata-varinfo repository to HOSS.
99# 2024-01-03: Copied from HOSS repository to the Swath Projector.
1010# 2024-01-23: Copied and modified from Swath Projector repository to HyBIG.
11+ # 2025-09-24: Append git commit messages to release notes.
1112#
1213# ##############################################################################
1314
@@ -19,13 +20,34 @@ CHANGELOG_FILE="CHANGELOG.md"
1920VERSION_PATTERN=" ^## [\[]v"
2021
2122# # captures url links
22- # # [unreleased]:https://github.com/nasa/harmony-browse-image-generator/compare/1.2.0..HEAD
23- # # [v1.2.0]: https://github.com/nasa/harmony-browse-image-generator/compare/1.1.0..1.2.0
24- LINK_PATTERN=" ^\[.*\].*\.\..*"
23+ # # [v1.2.0]: https://github.com/nasa/harmony-browse-image-generator/releases/tags/1.2.0
24+ LINK_PATTERN=" ^\[.*\]:.*https://github.com/nasa"
2525
2626# Read the file and extract text between the first two occurrences of the
2727# VERSION_PATTERN
2828result=$( awk " /$VERSION_PATTERN /{c++; if(c==2) exit;} c==1" " $CHANGELOG_FILE " )
2929
30+ # Get all commit messages since the last release (marked with a git tag). If
31+ # there are no tags, get the full commit history of the repository.
32+ if [[ $( git tag) ]]
33+ then
34+ # There are git tags, so get the most recent one
35+ GIT_REF=$( git describe --tags --abbrev=0)
36+ else
37+ # There are not git tags, so get the initial commit of the repository
38+ GIT_REF=$( git rev-list --max-parents=0 HEAD)
39+ fi
40+
41+ # Retrieve the title line of all commit messages since $GIT_REF, filtering out
42+ # those from the pre-commit-ci[bot] author and any containing the string
43+ # "nasa/pre-commit-ci-update-config", which may result from merge commits.
44+ GIT_COMMIT_MESSAGES=$( git log --oneline --format=" %s" --perl-regexp --author=' ^(?!pre-commit-ci\[bot\]).*$' --grep=" nasa\/pre-commit-ci-update-config" --invert-grep ${GIT_REF} ..HEAD)
45+
46+ # Append git commit messages to the release notes:
47+ if [[ ${GIT_COMMIT_MESSAGES} ]]
48+ then
49+ result+=" \n\n## Commits\n\n${GIT_COMMIT_MESSAGES} "
50+ fi
51+
3052# Print the result
31- echo " $result " | grep -v " $VERSION_PATTERN " | grep -v " $LINK_PATTERN "
53+ echo -e " $result " | grep -v " $VERSION_PATTERN " | grep -v " $LINK_PATTERN "
0 commit comments