Skip to content
New issue

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

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

Already on GitHub? # to your account

Add script to generate release notes changelog #243

Merged
merged 9 commits into from
Oct 6, 2020
Merged

Conversation

macumber
Copy link
Collaborator

@macumber macumber commented Oct 2, 2020

No description provided.

@macumber macumber requested a review from jmarrec October 2, 2020 18:03
@jmarrec
Copy link
Collaborator

jmarrec commented Oct 5, 2020

Example of output:

What is ![Fixed:][fixed] supposed to be? I don't see it render in markdown

  • ![Fixed:][fixed] #32, Add github pages CI

Copy link
Collaborator

@jmarrec jmarrec left a comment

Choose a reason for hiding this comment

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

Thanks for adding this @macumber.

I made some changes and improvement of my own. If you can take a look at those that'd be great, and shed some light on the Fixed/Improve link/image too please


def print_issue(issue)
is_feature = false
issue.labels.each {|label| is_feature = true if label.name == "Enhancement Request"}
Copy link
Collaborator

Choose a reason for hiding this comment

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

With the right label, it works and I see from "Improved"

Comment on lines 5 to 22
# Get the begin date, by finding the last major/minor (X.Y.0) release
# that is at least a week old
def get_begin_date_and_previous_tag()
a_week_ago = Time.now - (60*60*24*7)

@github.repos.releases.list(owner: @repo_owner,
repo: @repo).each_page do |page|
page.each do |release|
next if release.tag_name !~ /^v\d\.\d\.0$/
release_date = Time.parse(release.created_at)
next if release_date > a_week_ago
puts "Found previous major/minor release: #{release.tag_name}, #{release_date}"
return release_date, " (#{release.tag_name})"
end
end
puts "Cannot find previous release, setting time to 2005"
return Time.new(2005, 01, 01), ""
end
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of harcoding the begin_date, infer it: look at a X.Y.0 release (patch level is 0) that is at least a week old (that should be sufficient to not get the current, freshly created release)

Comment on lines 44 to 49
if is_feature
"- ![Improved:][improved] [#{get_issue_num(issue)}]( #{get_html_url(issue)} ), #{get_title(issue)}"
else
"- ![Fixed:][fixed] [#{get_issue_num(issue)}]( #{get_html_url(issue)} ), #{get_title(issue)}"
end
end
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not following what ![Improved:][improved] is supposed to be. It seems halfways between an Image ![legend](link) and a icon or something? @macumber

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

These were buttons on a page a long time ago, I guess when we hosted release notes outside of GitHub. There is no need to keep them

Comment on lines +1 to +4
name: Create release notes changelog
on:
release:
types: [created]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Added a github actions that will do:

ruby GithubIssueStats.rb > changelog.txt

Then a python script that will locate the created release, and basically do current_release.body += changelog

This is untested since it will not run until it's on develop and I create a release, but I have tested it that the python script works fine.

next if release.tag_name !~ /^v\d\.\d\.0$/
release_date = Time.parse(release.created_at)
next if release_date > a_week_ago
puts "Found previous major/minor release: #{release.tag_name}, #{release_date}"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe skip pre-releases?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

next if release.prerelease

Copy link
Collaborator

Choose a reason for hiding this comment

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

Matching to /^v\d\.\d\.0$/, so that will skip anything that isn't tagged like X.Y.Z. A pre-release should have a a suffix, like -alpha1 or -rc1 or whatnot.

@macumber
Copy link
Collaborator Author

macumber commented Oct 6, 2020

Above and beyond as always @jmarrec, looks good, I left one suggestion

@jmarrec jmarrec merged commit 7dd57e4 into develop Oct 6, 2020
@jmarrec jmarrec deleted the issue_stats branch October 6, 2020 08:30
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants