Add information and separator to unreleased.sh output (#13827)

changelog_begin
changelog_end

Adds a small separator between changelog entries for separate commits to improve readability.

Adds a "title" to each changelog entry to provide context to the reader to ensure that
the changelog entry can be traced back to a commit. The title line is composed of the
commit subject (which usually includes the PR number), author and hash. This set of
information should help the reader trace back a changelog entry to a commit/PR to
improve the understanding of the contribution in case the changelog entry is difficult
to understand without proper context.

As an example, given the following command:

```
./unreleased.sh v2.2.0-snapshot.20220425.9780.0.f4d60375..v2.2.0-snapshot.20220504.9851.0.4c8e027d
```

here is the difference for the first few lines of output.

Before:

```
Fixing Ledger API Bug: Exercise nodes in transaction trees
have child_event_ids out of order.

- [HTTP-JSON] The field "@type" was renamed to "type" for encoding the ErrorDetails case

- [Daml Triggers] Add `queryFilter` matching Daml Script’s
  `queryFilter` which queries contracts of a given template and filters
  them down to those where the predicate holds.
```

After:

```
* Fix random exercise node's childEventId order [DPP-1018] (#13740) (committer: Marton Nagy | hash: 0ea140f51e)
Fixing Ledger API Bug: Exercise nodes in transaction trees
have child_event_ids out of order.
----------------
* Use deriveFormat for ErrorDetailsFormat instead of hand written JsonFormat (#13770) (committer: Victor Peter Rouven Müller | hash: 3decea2a95)

- [HTTP-JSON] The field "@type" was renamed to "type" for encoding the ErrorDetails case

----------------
* Updating Titles and Headings (#13592) (committer: carrielaben-da | hash: 58c615a251)

----------------
* Add queryFilter to triggers (#13769) (committer: Moritz Kiefer | hash: d3280ac87d)

- [Daml Triggers] Add `queryFilter` matching Daml Script’s
  `queryFilter` which queries contracts of a given template and filters
  them down to those where the predicate holds.
```

Another further advantage is that it's now clearer to identify sources
of dangling newlines. I tried fix those myself but to no avail. I'm open
to suggestions as to how to get rid of empty changelog entries that
still happen to contain just newlines (I think that's the source of the
issue).
This commit is contained in:
Stefano Baghino 2022-05-09 17:49:36 +02:00 committed by GitHub
parent 51d7575705
commit 0798fe155b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,5 +39,11 @@ extract_changelog () {
for SHA in $COMMITS_IN_GIVEN_RANGE; do
COMMIT_MESSAGE_BODY=$(git show --quiet --format=%b "$SHA")
echo "$COMMIT_MESSAGE_BODY" | extract_changelog
COMMIT_CHANGELOG=$(echo "$COMMIT_MESSAGE_BODY" | extract_changelog)
if [[ ! -z "$COMMIT_CHANGELOG" ]]; then
COMMIT_AUTHOR_AND_SUBJECT=$(git show --quiet --format="* %s (committer: %an | hash: %h)" "$SHA")
echo "$COMMIT_AUTHOR_AND_SUBJECT"
echo "$COMMIT_CHANGELOG"
echo "----------------"
fi
done