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 to generate github markdown for release notes #1487
Conversation
Codecov Report
@@ 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.
|
There was a problem hiding this 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.
2f9c1ab
to
99d9478
Compare
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}" |
There was a problem hiding this comment.
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 asevalml_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'
andawk '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!
There was a problem hiding this 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.
99d9478
to
98ef7e9
Compare
Usage:
tools/format_format_release_notes.sh
to print out the markdown to paste into the release PR and github releaseIt was only a matter of time 😂 https://xkcd.com/1319/