diff --git a/.github/workflows/publish_docker_image.yml b/.github/workflows/publish_docker_image.yml index a218fa4..dc537e3 100644 --- a/.github/workflows/publish_docker_image.yml +++ b/.github/workflows/publish_docker_image.yml @@ -36,9 +36,9 @@ jobs: steps: - name: Checkout harmony-metadata-annotator repository - uses: actions/checkout@v3 + uses: actions/checkout@v5 with: - lfs: true + fetch-depth: 0 - name: Extract semantic version number run: echo "semantic_version=$(cat docker/service_version.txt)" >> $GITHUB_ENV diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index a54c9a7..cc4ba04 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -16,9 +16,7 @@ jobs: steps: - name: Checkout harmony-metadata-annotator repository - uses: actions/checkout@v3 - with: - lfs: true + uses: actions/checkout@v5 - name: Build service image run: ./bin/build-image diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d3c9d1..1e6d587 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [vX.Y.Z] - Unreleased + +### Changed + +- Release notes for the Metadata Annotator will now include the commit history + for that release. + ## [v1.3.0] - 2025-09-16 ### Changed diff --git a/bin/extract-release-notes.sh b/bin/extract-release-notes.sh index cbb186f..b6b269a 100755 --- a/bin/extract-release-notes.sh +++ b/bin/extract-release-notes.sh @@ -1,7 +1,9 @@ #!/bin/bash ################################################################################## # -# Extract release notes for the latest version of Harmony CF Annotator service +# 2025-02-20: Extract release notes for the latest version of Harmony Metadata +# Annotator service +# 2025-09-23: Append git commit messages to release notes. # ################################################################################## @@ -13,13 +15,34 @@ CHANGELOG_FILE="CHANGELOG.md" VERSION_PATTERN="^## [\[]v" ## captures url links -## [unreleased]:https://github.com/nasa/harmony-cf-annotator/compare/1.2.0..HEAD -## [v1.2.0]: https://github.com/nasa/harmony-cf-annotator/compare/1.1.0..1.2.0 -LINK_PATTERN="^\[.*\].*releases/tag/.*" +## [v1.2.0]: https://github.com/nasa/harmony-metadata-annotator/releases/tags/1.2.0 +LINK_PATTERN="^\[.*\]:.*https://github.com/nasa" # Read the file and extract text between the first two occurrences of the # VERSION_PATTERN result=$(awk "/$VERSION_PATTERN/{c++; if(c==2) exit;} c==1" "$CHANGELOG_FILE") +# Get all commit messages since the last release (marked with a git tag). If +# there are no tags, get the full commit history of the repository. +if [[ $(git tag) ]] +then + # There are git tags, so get the most recent one + GIT_REF=$(git describe --tags --abbrev=0) +else + # There are not git tags, so get the initial commit of the repository + GIT_REF=$(git rev-list --max-parents=0 HEAD) +fi + +# Retrieve the title line of all commit messages since $GIT_REF, filtering out +# those from the pre-commit-ci[bot] author and any containing the string +# "nasa/pre-commit-ci-update-config", which may result from merge commits. +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) + +# Append git commit messages to the release notes: +if [[ ${GIT_COMMIT_MESSAGES} ]] +then + result+="\n\n## Commits\n\n${GIT_COMMIT_MESSAGES}" +fi + # Print the result -echo "$result" | grep -v "$VERSION_PATTERN" | grep -v "$LINK_PATTERN" +echo -e "$result" | grep -v "$VERSION_PATTERN" | grep -v "$LINK_PATTERN"