@@ -284,10 +284,11 @@ def warn_changelog_missing(gem_root:, npm_version:)
284284 puts "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ"
285285end
286286
287- def sync_github_release_after_publish ( gem_root :, gem_version :, dry_run :)
287+ def sync_github_release_after_publish ( gem_root :, gem_version :, dry_run :, changelog_section : nil )
288288 npm_version = Shakapacker ::Utils ::VersionSyntaxConverter . new . rubygem_to_npm ( gem_version )
289- changelog_path = File . join ( gem_root , "CHANGELOG.md" )
290- section = extract_changelog_section ( changelog_path : changelog_path , npm_version : npm_version )
289+ section = changelog_section || extract_changelog_section (
290+ changelog_path : File . join ( gem_root , "CHANGELOG.md" ) , npm_version : npm_version
291+ )
291292
292293 unless section
293294 puts "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ"
@@ -470,6 +471,11 @@ def print_release_summary(release_result)
470471 puts "\n Files that would be updated:"
471472 staged_files . each { |file | puts " - #{ file } " }
472473 puts " - package.json (updated by release-it)"
474+ if changelog_section_found
475+ puts "\n Changelog: ✓ CHANGELOG.md section found for v#{ released_npm_version } "
476+ else
477+ puts "\n Changelog: ⚠ No CHANGELOG.md section for v#{ released_npm_version } — add one before releasing."
478+ end
473479 puts "\n To actually release, run: rake \" release[#{ released_gem_version } ]\" "
474480 return
475481 end
@@ -591,13 +597,17 @@ def perform_release(
591597
592598 end
593599
594- unless dry_run
595- sync_gem_version = released_gem_version || gem_version . to_s . strip
596- if sync_gem_version && !sync_gem_version . empty?
597- released_npm_version ||= Shakapacker ::Utils ::VersionSyntaxConverter . new . rubygem_to_npm ( sync_gem_version )
598- changelog_path = File . join ( gem_root , "CHANGELOG.md" )
599- changelog_section_found = !extract_changelog_section ( changelog_path : changelog_path , npm_version : released_npm_version ) . nil?
600- sync_github_release_after_publish ( gem_root : gem_root , gem_version : sync_gem_version , dry_run : dry_run )
600+ # Check changelog availability for the summary (both dry-run and live paths).
601+ sync_gem_version = released_gem_version || gem_version . to_s . strip
602+ if sync_gem_version && !sync_gem_version . empty?
603+ released_npm_version ||= Shakapacker ::Utils ::VersionSyntaxConverter . new . rubygem_to_npm ( sync_gem_version )
604+ changelog_path = File . join ( gem_root , "CHANGELOG.md" )
605+ changelog_section = extract_changelog_section ( changelog_path : changelog_path , npm_version : released_npm_version )
606+ changelog_section_found = !changelog_section . nil?
607+
608+ unless dry_run
609+ sync_github_release_after_publish ( gem_root : gem_root , gem_version : sync_gem_version , dry_run : dry_run ,
610+ changelog_section : changelog_section )
601611 end
602612 end
603613
0 commit comments