Skip to content

Commit 92ce55a

Browse files
authored
Report "no changes" in the release description (#30)
1 parent 1b3505b commit 92ce55a

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

lib/create_github_release/project.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,8 @@ def next_release_description
578578
579579
[Full Changelog](#{release_log_url})
580580
581+
Changes since #{last_release_tag}:
582+
581583
#{list_of_changes}
582584
DESCRIPTION
583585
end
@@ -762,6 +764,8 @@ def quiet
762764
# @return [String] The list of changes in the release as a string
763765
# @api private
764766
def list_of_changes
767+
return '* No changes' if changes.empty?
768+
765769
changes.map do |change|
766770
"* #{change.sha} #{change.subject}"
767771
end.join("\n")

spec/create_github_release/project_spec.rb

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,8 @@
506506
507507
[Full Changelog](https://github.com/username/repo/compare/v0.1.0..v1.0.0)
508508
509+
Changes since v0.1.0:
510+
509511
* e718690 Release v1.0.0 (#3)
510512
* ab598f3 Fix Rubocop offenses (#2)
511513
NEXT_RELEASE_DESCRIPTION
@@ -514,6 +516,30 @@
514516
it { is_expected.to eq(expected_next_release_description) }
515517
end
516518

519+
context 'when there are no changes' do
520+
before do
521+
project.remote_url = URI.parse('https://github.com/username/repo')
522+
project.last_release_tag = 'v0.1.0'
523+
project.next_release_tag = 'v1.0.0'
524+
project.next_release_date = Date.new(2022, 11, 7)
525+
project.changes = []
526+
end
527+
528+
let(:expected_next_release_description) do
529+
<<~NEXT_RELEASE_DESCRIPTION
530+
## v1.0.0 (2022-11-07)
531+
532+
[Full Changelog](https://github.com/username/repo/compare/v0.1.0..v1.0.0)
533+
534+
Changes since v0.1.0:
535+
536+
* No changes
537+
NEXT_RELEASE_DESCRIPTION
538+
end
539+
540+
it { is_expected.to eq(expected_next_release_description) }
541+
end
542+
517543
context 'when next_release_description is explicitly set' do
518544
let(:next_release_description) { 'This is a release description' }
519545
before { project.next_release_description = next_release_description }

0 commit comments

Comments
 (0)