-
-
Notifications
You must be signed in to change notification settings - Fork 849
Add option to show selected labels in the issue line #418
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
Conversation
Hi Ari! Glad you wanted to add a feature to this tool. To make this PR mergeable, you need to rebase it on top of master. At this point, master has OctoKit in it.
It's awesome to see new people modify this to their needs. Can you find a way to make the above happen? If not, would you want me to make the changes, carrying your PR into master? |
I've updated the code and rebased on top of the latest Master commit. I can also update the wiki page to document this option once the pull request is merged. I've found this to be a very flexible and helpful utility for creating Changelogs. |
The second feature I was thinking of as missing after using the tool for the first time 👍 |
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.
Cool!
I made some edit notes, so that the change can be merged.
@@ -205,6 +208,7 @@ def self.default_options | |||
enhancement_labels: %w(enhancement Enhancement), | |||
bug_labels: %w(bug Bug), | |||
exclude_labels: %w(duplicate question invalid wontfix Duplicate Question Invalid Wontfix), | |||
issue_line_labels: [], |
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.
The KNOWN_OPTIONS
constant needs this setting name as well:
end | ||
labels_string = labels.map { |label| " \[[#{label['name']}](#{label['url'].sub! 'api.github.com/repos', 'github.com'})\]" }.join("") | ||
line = "#{line}#{labels_string}" | ||
line |
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.
I would be more comfortable with a function that only calculated the labels string from the issue
data:
def line_labels_for(issue)
labels = if options[:issue_line_labels] == ["ALL"]
issue["labels"]
else
issue["labels"].select { |label| options[:issue_line_labels].include?(label["name"]) }
end
labels.map { |label| " \[[#{label['name']}](#{label['url'].sub('api.github.com/repos', 'github.com')})\]" }.join("")
end
This could be used like
if options[:issue_line_labels].present?
title_with_number = "#{title_with_number}{line_labels_for(issue)}"
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.
@olleolleolle, this all works for me. Thanks for making the code changes (I'm not a Ruby developer, but this project has been very useful). I've updated the code for this issue and rebased.
@aih In my changes, I used ActiveSupport core_ext methods. That's not prevalent around all of the code, but it's there. |
Thanks, @aih! This looks grand. I'll merge it, pending all the builds. Yay! |
:party: |
Great addition! Thanks! 👍 |
end | ||
labels.map { |label| " \[[#{label['name']}](#{label['url'].sub('api.github.com/repos', 'github.com')})\]" }.join("") | ||
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.
@aih can you add tests to covers cases with new method?
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.
Everything is great, just want to mention, that line_labels_for
is not covered by tests yet.
This adds an option,
--issue-line-labels
, which allows the user to list the specified Github labels, in brackets, next to each issue.For example, when issue #367 of this repository is closed, the Changelog for that issue, with option
--issue-line-labels=ALL
will look like this:Selected labels can be specified in the option:
--issue-line-labels=first-timers-only
will generate the following line:Related to #316