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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add script to generate github markdown for release notes #1487

Merged
merged 8 commits into from Dec 2, 2020

Conversation

dsherry
Copy link
Contributor

@dsherry dsherry commented Dec 1, 2020

Usage:

  • Make release branch, update version, update release notes
  • Run tools/format_format_release_notes.sh to print out the markdown to paste into the release PR and github release

It was only a matter of time 馃槀 https://xkcd.com/1319/

@dsherry dsherry added the enhancement An improvement to an existing feature. label Dec 1, 2020
@codecov
Copy link

codecov bot commented Dec 1, 2020

Codecov Report

Merging #1487 (98ef7e9) into main (b49e2fc) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1487   +/-   ##
=======================================
  Coverage   100.0%   100.0%           
=======================================
  Files         223      223           
  Lines       15139    15139           
=======================================
  Hits        15132    15132           
  Misses          7        7           

Continue to review full report at Codecov.

Legend - Click here to learn more
螖 = absolute <relative> (impact), 酶 = not affected, ? = missing data
Powered by Codecov. Last update b49e2fc...98ef7e9. Read the comment docs.

Copy link
Contributor

@jeremyliweishih jeremyliweishih left a comment

Choose a reason for hiding this comment

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

Looks good but needs to grab between Future Releases and the latest version.

tools/format_release_notes.sh Outdated Show resolved Hide resolved
tools/format_release_notes.sh Outdated Show resolved Hide resolved
@dsherry dsherry force-pushed the ds_release_github_markdown_formatter branch from 2f9c1ab to 99d9478 Compare December 2, 2020 18:57
date_formatted=$(date '+%b. %-d, %Y')
content_markdown=$(echo -n "${content_raw}" | sed 's/^ \* /- /g' | sed 's/^ \* /### /g' | sed 's/ \*\*Breaking Changes\*\*/### Breaking Changes/g' | sed -E "s/:pr:\`([0-9]+)\`/#\1/g")
full_markdown=$(echo -e "# v${evalml_version} ${date_formatted}\n${content_markdown}")
echo -e "${full_markdown}"
Copy link
Contributor Author

@dsherry dsherry Dec 2, 2020

Choose a reason for hiding this comment

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

@angela97lin @jeremyliweishih I think I fixed the hard-coding here, and I broke things up so it should be a bit easier to follow! It was pretty soupy before.

@angela97lin you mentioned this is like magic--I agree, unix utilities are beautiful magic 鉁 quick breakdown of what's going on:

  • The "|" operator is the unix pipe mechanism which passes output along to subsequent commands
  • var=$(...): evaluating commands in sub-shells to save the output.
  • sed is a super handy find-replace utility. I used it on line 12 to define a regex group and extract the matching version number as evalml_version
  • Then by including "p" and "q" commands with sed on line 13, we're telling it to print everything after a match or to print everything up to a match, respectively. That lets us get all the lines between the last release header (i.e. the one about to go out) and the release header before that.
  • tail, sed '$ d' and awk 'NF' are just hacks to remove leading/trailing lines and whitespace
  • The usage of date below gets the date in the exact human-readable format we use it in our release notes.
  • The markdown part just uses a sequence of sed commands to replace specific line prefixes with their markdown counterparts, and then to convert our pr tags to use a hash for markdown.
  • Finally we put it all together in full_markdown and output the result at the end!

Copy link
Contributor

@freddyaboulton freddyaboulton left a comment

Choose a reason for hiding this comment

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

Very cool @dsherry ! I just tested it out locally and it works as expected!

Thanks for explaining what was happening with all of the sed and awk commands.

@dsherry dsherry force-pushed the ds_release_github_markdown_formatter branch from 99d9478 to 98ef7e9 Compare December 2, 2020 21:38
@dsherry dsherry merged commit 3987ab7 into main Dec 2, 2020
@dsherry dsherry deleted the ds_release_github_markdown_formatter branch December 2, 2020 21:59
@dsherry dsherry mentioned this pull request Dec 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An improvement to an existing feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants