release_notes: use safe_popen_read.

Otherwise if `git log` fails (e.g. due to missing `origin/HEAD` in my
case) then it will generate a release with empty release notes.
This commit is contained in:
Mike McQuaid 2021-08-03 08:51:46 +01:00
parent 265c8c36a4
commit 40b2340ba3
No known key found for this signature in database
GPG Key ID: 3338A31AFDB1D829

View File

@ -14,7 +14,7 @@ module ReleaseNotes
.returns(String) .returns(String)
} }
def generate_release_notes(start_ref, end_ref, markdown: false) def generate_release_notes(start_ref, end_ref, markdown: false)
Utils.popen_read( Utils.safe_popen_read(
"git", "-C", HOMEBREW_REPOSITORY, "log", "--pretty=format:'%s >> - %b%n'", "#{start_ref}..#{end_ref}" "git", "-C", HOMEBREW_REPOSITORY, "log", "--pretty=format:'%s >> - %b%n'", "#{start_ref}..#{end_ref}"
).lines.map do |s| ).lines.map do |s|
matches = s.match(%r{.*Merge pull request #(?<pr>\d+) from (?<user>[^/]+)/[^>]*>> - (?<body>.*)}) matches = s.match(%r{.*Merge pull request #(?<pr>\d+) from (?<user>[^/]+)/[^>]*>> - (?<body>.*)})