diff --git a/lib/git/pr/release/util.rb b/lib/git/pr/release/util.rb index 8ae61ae..8689715 100644 --- a/lib/git/pr/release/util.rb +++ b/lib/git/pr/release/util.rb @@ -157,7 +157,7 @@ def merge_pr_body(old_body, new_body) merged_body = pr_body_lines.join("\n") check_status.each { |issue_number, check_value| say "Update pull-request checkbox \##{issue_number} to #{check_value}.", :trace - merged_body.gsub! /^- \[ \] \##{issue_number}/, "- [#{check_value}] \##{issue_number}" + merged_body.gsub! /^- \[ \] \##{issue_number}\b/, "- [#{check_value}] \##{issue_number}" } merged_body diff --git a/spec/git/pr/release_spec.rb b/spec/git/pr/release_spec.rb index 5978eef..31a5a0d 100644 --- a/spec/git/pr/release_spec.rb +++ b/spec/git/pr/release_spec.rb @@ -90,6 +90,26 @@ MARKDOWN } end + context "new pr added when the same numbers are included in a forward match" do + it { + actual = merge_pr_body(<<~OLD_BODY, <<~NEW_BODY) + - [x] #3 Provides a creating release pull-request object for template @hakobe + - [ ] #6 Support two factor auth @ninjinkun + OLD_BODY + - [ ] #3 Provides a creating release pull-request object for template @hakobe + - [ ] #4 use user who create PR if there is no assignee @hakobe + - [ ] #6 Support two factor auth @ninjinkun + - [ ] #30 Extract logic from bin/git-pr-release @banyan + NEW_BODY + + expect(actual).to eq <<~MARKDOWN.chomp + - [x] #3 Provides a creating release pull-request object for template @hakobe + - [ ] #4 use user who create PR if there is no assignee @hakobe + - [ ] #6 Support two factor auth @ninjinkun + - [ ] #30 Extract logic from bin/git-pr-release @banyan + MARKDOWN + } + end end describe "#host_and_repository_and_scheme" do