github_changelog_generator 1.17.0 → 1.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e07c565356c5e5e983b771c56833c9579afd0d174ca6930a70699e38486afb8d
4
- data.tar.gz: f9fca1bd85bef606332a6da07c01f093adbecd7a26256c6826a593d8b15a5ebb
3
+ metadata.gz: 4b4b0ae75606e17c5e16de177c480681cd39a56e4898d1dc411187aa65115694
4
+ data.tar.gz: 844d1023dcb2fd10c3ed6045fd190882092a2ff2525153bbd6017b0c72c43458
5
5
  SHA512:
6
- metadata.gz: a312859c596e52e04c52d9fef05b2552f64c6efc8117b7c948451566ac2de67416407d3aaed0a675ece080cbf6ebda41b0ed65db3154427525f8896e6829ba94
7
- data.tar.gz: 3f44449ed200a68d14670f471a81a36932a2ec171b6b8c44362bc554f3d2aadf484e882eb61888e599d20df362e851d850b861103441ce0d8be3df975b8cc128
6
+ metadata.gz: 8e68b447064d152fa0142e4883d67fd7636887204612b57e9130aa3564b4f591d97cfa98a503f3c7f5eff3f8de592216e1ef53a5b3e8f9dffcaa4b477bfbeaad
7
+ data.tar.gz: 9d0e534125f4fb418034aa63c3404e37aadb6a2c9c59f27b26bc384e60365793379ebbd0418d2cc6afb2cfbc63541f6863e56737ca5eb9a4d642ec6cc2cacacb
@@ -17,7 +17,7 @@ module GitHubChangelogGenerator
17
17
 
18
18
  def initialize(options = Options.new({}))
19
19
  @content = ""
20
- @options = Options.new(options)
20
+ @options = options.is_a?(Options) ? options : Options.new(options)
21
21
  end
22
22
 
23
23
  # Generates log entry with header and body
@@ -209,8 +209,10 @@ module GitHubChangelogGenerator
209
209
  # Only add unmapped issues
210
210
  issues.select { |issue| issue["labels"].any? }
211
211
  end
212
- merged = Section.new(name: name, prefix: prefix, labels: [], issues: add_issues, options: @options) unless add_issues.empty?
213
- @sections << merged
212
+ unless add_issues.empty?
213
+ merged = Section.new(name: name, prefix: prefix, labels: [], issues: add_issues, options: @options)
214
+ @sections << merged
215
+ end
214
216
  end
215
217
  nil
216
218
  end
@@ -127,7 +127,7 @@ module GitHubChangelogGenerator
127
127
  # skip if we are already at the oldest element
128
128
  return if idx == sorted_tags.size - 1
129
129
 
130
- sorted_tags[idx - 1]
130
+ sorted_tags[idx + 1]
131
131
  end
132
132
 
133
133
  def tag_older_new_tag?(newer_tag_time, time)
@@ -208,7 +208,8 @@ Make sure, that you push tags to remote repo via 'git push --tags'"
208
208
  # @param [Array] issues
209
209
  # @return [Void]
210
210
  def fetch_events_async(issues)
211
- i = 0
211
+ fetched_count = 0
212
+ mutex = Mutex.new
212
213
  # Add accept option explicitly for disabling the warning of preview API.
213
214
  preview = { accept: Octokit::Preview::PREVIEW_TYPES[:project_card_events] }
214
215
 
@@ -225,8 +226,8 @@ Make sure, that you push tags to remote repo via 'git push --tags'"
225
226
  issue["events"].concat(new_event)
226
227
  end
227
228
  issue["events"] = issue["events"].map { |event| stringify_keys_deep(event.to_hash) }
228
- print_in_same_line("Fetching events for issues and PR: #{i + 1}/#{issues.count}")
229
- i += 1
229
+ current = mutex.synchronize { fetched_count += 1 }
230
+ print_in_same_line("Fetching events for issues and PR: #{current}/#{issues.count}")
230
231
  end
231
232
  end
232
233
 
@@ -236,7 +237,7 @@ Make sure, that you push tags to remote repo via 'git push --tags'"
236
237
  print_empty_line
237
238
  end
238
239
 
239
- Helper.log.info "Fetching events for issues and PR: #{i}"
240
+ Helper.log.info "Fetching events for issues and PR: #{fetched_count}"
240
241
  end
241
242
 
242
243
  # Fetch comments for PRs and add them to "comments"
@@ -345,13 +346,13 @@ Make sure, that you push tags to remote repo via 'git push --tags'"
345
346
  # @param [String] name
346
347
  # @return [Array<String>]
347
348
  def commits_in_branch(name)
348
- @branches ||= lambda do
349
+ @branches ||= begin
350
+ all_branches = {}
349
351
  iterate_pages(client, "branches") do |branches|
350
- branches_map = branches.to_h { |branch| [branch[:name], branch] }
351
- return branches_map if branches_map[name]
352
+ branches.each { |branch| all_branches[branch[:name]] = branch }
352
353
  end
353
- {}
354
- end.call
354
+ all_branches
355
+ end
355
356
 
356
357
  if (branch = @branches[name])
357
358
  commits_in_tag(branch[:commit][:sha])
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GitHubChangelogGenerator
4
- VERSION = "1.17.0"
4
+ VERSION = "1.18.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: github_changelog_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.17.0
4
+ version: 1.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Petr Korolev
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2026-03-13 00:00:00.000000000 Z
13
+ date: 2026-03-18 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport