Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add script for generating release notes automatically #91

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

henriquesimoes
Copy link

Based on a collaboration meeting discussion, I've written a script to generate the release notes for arbitrary tags (actually, commits) from this top-level repository with proper links for corresponding release notes. The generated sections are the following:

  • Module releases. Tagged modules are the ones that were git-taged in the release commit range. Such modules have well-defined release notes that document the changes, which are linked¹.
  • Modules with untagged updates. They do not necessarily have partial release notes, so only their changeset (rendered by GitHub) is linked instead.
  • New modules, listed in the same format used by (un)tagged modules, but in a separate section to make clear they weren't previously available.

A "removed modules" section could be also created. However, an unexpected behavior of git-diff(1) is that it does not include removed submodules in its output. Thus, another approach should be taken for that.

I decided to script that in bash, since it is basically a manipulation of several git commands. Let me know if you think that might become a maintainability issue.

git-diff(1) is used to track which changes were made, so that we only
check the required submodules. To take submodule changes, a match
against git-ls-tree(1) output is done to retrieve the first commit in
the submodule in the specified top-level range. An alternative (and
simpler) approach to take the same information is to use `git-diff
--submodule=log` option and parse the "Submodule" lines, but this is not
known to be stable.

The first commmit is used to get tags created since then until HEAD,
using git-tag(1) API. This simplification of using HEAD can be easily
removed, to allow arbitrary past ranges.
compare_url=$github_url/$module/compare/$start_commit..$end_commit

if [ ${#tags[@]} -gt 0 ]; then
echo "* [$module]($compare_url) [${tags[@]}]($release_notes_url#${tags[-1],,})"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that here I'm using a pattern for the anchor that is not compatible with existing release notes from submodules. I'm assuming we could change to a simpler header which is only the tag.

It seems feasible to download the corresponding release file and get the header from that. But the same algorithm for reducing that into an anchor would need to be implemented here. I'm not sure if we'd like to do that.

@henriquesimoes
Copy link
Author

An example of the generated note is available at #89, and can be seen rendered here.

@GDYendell
Copy link

I have only quickly looked through the script, but I think it looks good and I like the output. I am not sure it should do the compare versions link for a newly added module, though. Maybe it could just be just link to the repo?

@henriquesimoes
Copy link
Author

Maybe it could just be just link to the repo?

That seems nice for me.

The included sections are modules released, untagged updates and new
modules. Commits are taken only from the diff range, so that it can also
be used for generating releases from arbitrary commit ranges.

Released modules are the ones that were git-tagged in the release commit
range. Such modules have well-defined release notes that document the
changes, which are linked.

On the other hand, modules with untagged changes do not necessarily have
partial release notes, so only their changeset is linked instead.

New modules are listed in a separate section to make clear they weren't
previously available. A direct link to the repository is provided along
with release note links if applicable.

A 'removed modules' section could be also created. However, an
unexpected behavior of git-diff(1) is that it does not include removed
submodules in its output. Thus, another approach should be taken for
that.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants