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

Use the changelog to generate an better commit message (or annotated tag) #218

Open
hgrecco opened this issue Apr 18, 2017 · 4 comments · May be fixed by #439
Open

Use the changelog to generate an better commit message (or annotated tag) #218

hgrecco opened this issue Apr 18, 2017 · 4 comments · May be fixed by #439

Comments

@hgrecco
Copy link

hgrecco commented Apr 18, 2017

GitHub uses the commit information (or the tag annotation) to make the release notes (see for example, https://github.com/zestsoftware/zest.releaser/releases/tag/6.10)

It would be nice to take from the corresponding section from the change log and use it.

@reinout
Copy link
Collaborator

reinout commented Apr 19, 2017

That seems like it would be relatively easy.

Is it just a matter of copy/pasting the changelog lines into the tag commit message?

@hgrecco
Copy link
Author

hgrecco commented Apr 19, 2017

It seems so according to what I see in my repo and https://help.github.com/articles/about-releases/

May be instead of having Tagging 0.6 we could have something like

Whats new in 0.6 (DATE)
-----------------------

<here goes the changelog>

The only thing I am not clear about is that if you are logged into github and go to https://github.com/YOUR_USERNAME/YOUR_REPO/tags you will see a link in the right hand side of the screen, next to each tag which says:

Add release notes
(No release notes)

I am not clear how tag annotations interact with this feature or if there is a way to feed this part of github from a git commit/tag.

In any case, just the other part would be a nice improvement.

@gforcada
Copy link
Contributor

🙌🏾 I was about to report this, and @hgrecco was faster than me for +6 years 😅

I'm also trying to automate getting the release notes from CHANGES.(rst|md) into GitHub releases, so far my script is as ugly as:

# get the lines where the changelog for the last release starts and finishes
first_line=$(grep -n "\-\-\-\-" CHANGES.rst | cut -d":" -f1 |head -n1)
last_line=$(grep -n "\-\-\-\-" CHANGES.rst | cut -d":" -f1 |head -n2 | tail -n1)

# do some math to adjust the line numbers
first=$((${first_line}+1))
last=$((${last_line}-2))
end=$((${last_line}-1))

# extract the changelog
sed -n "${first},${last}p;${end}q" CHANGES.rst > body.txt

# debug
cat body.txt

# actual release creation (so far with `-p` to mark them as pre-releases)
gh release create ${{ github.ref_name }} -p -F body.txt

The whole mambo-jumbo of grep/sed could be avoided if the annotated tag would have the changelog already on it.

Then all the above would only be:

gh release create ${{ github.ref_name }} --notes-from-tag

✨ 💫

How hard would it be to get the changelog on an annotated tag? 🤔 🤞🏾

@gforcada
Copy link
Contributor

Turns out, after a bit of digging and testing, that the --notes-from-tag for the gh release create command is not looking at the commit message on the tag itself, but rather the commit where the tag belongs to 🤷🏾

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 a pull request may close this issue.

3 participants