Skip to content

Commit

Permalink
Fix undefined line_labels_for
Browse files Browse the repository at this point in the history
  • Loading branch information
ddeath authored and ferrarimarco committed Apr 11, 2020
1 parent 7bd94fc commit 8525969
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions lib/github_changelog_generator/generator/entry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ def generate_entry_for_tag(pull_requests, issues, newer_tag_name, newer_tag_link
@content
end

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

private

# Creates section objects for this entry.
Expand Down Expand Up @@ -205,14 +214,5 @@ def add_unmapped_section(issues)
end
nil
end

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
end
end
4 changes: 2 additions & 2 deletions lib/github_changelog_generator/generator/section.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module GitHubChangelogGenerator
#
# @see GitHubChangelogGenerator::Entry
class Section
attr_accessor :name, :prefix, :issues, :labels, :body_only
attr_accessor :name, :options, :prefix, :issues, :labels, :body_only

def initialize(opts = {})
@name = opts[:name]
Expand Down Expand Up @@ -49,7 +49,7 @@ def get_string_for_issue(issue)
encapsulated_title = encapsulate_string issue["title"]

title_with_number = "#{encapsulated_title} [\\##{issue['number']}](#{issue['html_url']})"
title_with_number = "#{title_with_number}#{line_labels_for(issue)}" if @options[:issue_line_labels].present?
title_with_number = "#{title_with_number}#{Entry.new(options).line_labels_for(issue)}" if @options[:issue_line_labels].present?
line = issue_line_with_user(title_with_number, issue)
issue_line_with_body(line, issue)
end
Expand Down

0 comments on commit 8525969

Please sign in to comment.