Skip to content

Commit ef24f2b

Browse files
TRT-635: Update release notes to include git commit messages.
1 parent 52c562d commit ef24f2b

1 file changed

Lines changed: 23 additions & 1 deletion

File tree

bin/extract-release-notes.sh

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
# 2024-01-23: Copied and modified from Swath Projector repository to HyBIG.
1111
# 2025-07-15: Copied and modified from HyBIG to earthdata-hashdiff.
1212
# 2025-09-05: Copied and modified from earthdata-hashdiff to HGA.
13+
# 2025-09-22: Append git commit messages to release notes.
1314
#
1415
###############################################################################
1516

@@ -28,5 +29,26 @@ LINK_PATTERN="^\[.*\]:.*https://github.com/nasa"
2829
# VERSION_PATTERN
2930
result=$(awk "/$VERSION_PATTERN/{c++; if(c==2) exit;} c==1" "$CHANGELOG_FILE")
3031

32+
# Get all commit messages since the last release (marked with a git tag). If
33+
# there are no tags, get the full commit history of the repository.
34+
if [[ $(git tag) ]]
35+
then
36+
# There are git tags, so get the most recent one
37+
GIT_REF=$(git describe --tags --abbrev=0)
38+
else
39+
# There are not git tags, so get the initial commit of the repository
40+
GIT_REF=$(git rev-list --max-parents=0 HEAD)
41+
fi
42+
43+
# Retrieve the title line of all commit messages since $GIT_REF, filtering out
44+
# those from the pre-commit-ci[bot] author.
45+
GIT_COMMIT_MESSAGES=$(git log --oneline --format="%s" --perl-regexp --author='^(?!pre-commit-ci\[bot\]).*$' ${GIT_REF}..HEAD)
46+
47+
# Append git commit messages to the release notes:
48+
if [[ ${GIT_COMMIT_MESSAGES} ]]
49+
then
50+
result+="\n\n## Commits\n\n${GIT_COMMIT_MESSAGES}"
51+
fi
52+
3153
# Print the result
32-
echo "$result" | grep -v "$VERSION_PATTERN" | grep -v "$LINK_PATTERN"
54+
echo -e "$result" | grep -v "$VERSION_PATTERN" | grep -v "$LINK_PATTERN"

0 commit comments

Comments
 (0)